[CLOSED] How to display an Asterisk(*) next to Tpl column

  1. #1

    [CLOSED] How to display an Asterisk(*) next to Tpl column

    Hi,
    Can you please show me how to add an asterisk next to the template field if certain conditions are met. For example, in my code below, I would like to display an asterisk next to the {Description} column if ModelField "MASTEnabled" is "true".
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="Web.test" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.PlantsStore.DataSource = this.Data;
                this.PlantsStore.DataBind();
            }
        }
    
        private object[] Data
        {
            get
            {
                return new object[]
                {
                    new object[] { "3m Co", true },
                    new object[] { "Alcoa Inc", false },
                    new object[] { "Wal-Mart Stores, Inc.", true }
                };
            }
        }
    </script>
    
    
    </head>
    <body>
       <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
        <form id="form1" runat="server">
        <div>
         <ext:Container ID="Container1" runat="server">
                            <Items>
                                <ext:Panel ID="Panel1" runat="server" MarginSpec="14 0 0 650" Border="false">
                                    <Items>
                                        <ext:ComboBox ID="txtPlants" runat="server" EmptyText="Select Plant" ForceSelection="true"
                                            Icon="Building" FieldLabel="Plant" DisplayField="Description" Mode="Remote" ValueField="PlantId"
                                            Editable="false">
                                            <Store>
                                                <ext:Store ID="PlantsStore" runat="server" AutoLoad="true" AutoDataBind="true">
                                                   
                                                    <Model>
                                                        <ext:Model ID="Model1" runat="server">
                                                            <Fields>
                                                                <ext:ModelField Name="Description" Type="String" />
                                                                <ext:ModelField Name="MASTEnabled" Type="Boolean" />
                                                            </Fields>
                                                        </ext:Model>
                                                    </Model>
                                                </ext:Store>
                                            </Store>
                                            <ListConfig Width="520" Height="300" ItemSelector=".x-boundlist-item">
                                                <Tpl ID="Tpl1" runat="server">
                                                    <Html>
                                                        <tpl for=".">
                                                            <tpl if="[xindex] == 1">
                                                            <table class="cbDoughName-list">
                                                            <tr>
                                                              <th>Plant Name :</th>
                                                              <th>Enabled :</th>
                                                            </tr>
                                                       </tpl>
                                                           <tr class="x-boundlist-item">
                                                                <td style="Padding:3px 0px;">{Description}</td>
                                                                <td>{MASTEnabled}</td>
                                                            </tr>
                                                       <tpl if="[xcount-xindex]==0">
                                                       </table>
                                                 </tpl>
                                              </tpl>
                                                    </Html>
                                                </Tpl>
                                            </ListConfig>
                                            <Triggers>
                                                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                            </Triggers>
                                            <Listeners>
                                                 <BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                <TriggerClick Handler="if(index == 0) { el.focus().clearValue(); trigger.hide(); }" />
                                                  <Select Handler="this.getTrigger(0).show();" />
                                            </Listeners>
                                          
                                        </ext:ComboBox>
                                    </Items>
                                </ext:Panel>
                            </Items>
                        </ext:Container>
        </div>
        </form>
    </body>
    </html>
    Last edited by Daniil; Aug 24, 2012 at 4:52 AM. Reason: [CLOSED]
  2. #2
    <td style="Padding:3px 0px;">
    {Description}
    <tpl if="MASTEnabled">
    *
    </tpl>
    </td>
    Please see the following sample to investigate template syntax
    http://examples2.ext.net/#/Miscellan...late/Overview/
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Thank you! It works.

    Quote Originally Posted by Vladimir View Post
    <td style="Padding:3px 0px;">
    {Description}
    <tpl if="MASTEnabled">
    *
    </tpl>
    </td>
    Please see the following sample to investigate template syntax
    http://examples2.ext.net/#/Miscellan...late/Overview/

Similar Threads

  1. Replies: 0
    Last Post: Aug 22, 2011, 7:56 AM
  2. [CLOSED] Display sum of column in exported file
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 07, 2011, 7:18 PM
  3. [CLOSED] RecordField Name with asterisk
    By krzak in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 10, 2011, 5:10 PM
  4. how to hide/display CheckboxSelection column in GridPanel.
    By Satyanarayana murthy in forum 1.x Help
    Replies: 2
    Last Post: Feb 26, 2010, 9:07 AM
  5. [CLOSED] GridPanel: display a Column as a TextArea
    By pschojer in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 16, 2009, 7:51 AM

Posting Permissions