[CLOSED] How can I change fields inside <ItemTpl> in client side

  1. #1

    [CLOSED] How can I change fields inside <ItemTpl> in client side

    Hi,

    How can I change <ItemTpl> in client side? It is possible ? According to <ComboBox> selection, I need change the fields inside <ItemTpl>.

    Thanks,

    <ext:ComboBox ID="cboOption" runat="server" Editable="false"
        TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All">
                                                            
        <Items>
            <ext:ListItem Text="Option 1" Value="1" />
            <ext:ListItem Text="Option 2" Value="2" />
        </Items>
    
    </ext:ComboBox>
    
    <ext:ComboBox ID="cboItem" 
        AutoSelect="false"
        AutoShow="false"
        runat="server" 
        TypeAhead="false"
        HideBaseTrigger="true"
        MinChars="0"
        TriggerAction="Query" 
        Flex="1"  
        ForceSelection="false">
                                                    
        <Store>
            <ext:Store ID="storeItem" runat="server" AutoLoad="false" OnReadData="storeItem_read" >
        
                <Proxy>
                    <ext:PageProxy />
                </Proxy>
    
                <Model>
                    <ext:Model ID="Model1" runat="server">
                        <Fields>
    
                            <ext:ModelField Name="Field1" />
                            <ext:ModelField Name="Field2" />
                            <ext:ModelField Name="Field3" />
                            
                            <ext:ModelField Name="Field4" />
                            <ext:ModelField Name="Field5" />
                            <ext:ModelField Name="Field6" />
    
                        </Fields>
                    </ext:Model>                            
                </Model>
                <Parameters>
                                                                       
                    <ext:StoreParameter Name="text" Value="#{cboItem}.getValue()" Mode="Raw"/>
    
                </Parameters>
            </ext:Store>
        </Store>
    
        <ListConfig ID="lstCfg"  LoadingText="Searching...">
            <ItemTpl runat="server">
                <Html>
                    <div class="search-item">
                        
                        <%-- Config1 --%>
                        <%-- if (cboOption.getValue() == 1) // show this. --%>
                        <h3><span>{Field1}</span>{Field2}</h3>
                        {Field3}
                        
                        <%-- Config2 --%>
                        <%-- if (cboOption.getValue() == 2) // show this. --%>
                        <h3><span>{Field4}</span>{Field5}</h3>
                        {Field6}
            
                    </div>
                </Html>
            </ItemTpl>
        </ListConfig>
    </ext:ComboBox>
    Last edited by Daniil; Dec 24, 2013 at 8:27 AM. Reason: [CLOSED]
  2. #2
    Hello!

    Take a look at this documentation page: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.XTemplate

    As you can see you can use if, elseif and else operators in XTemplate.

Similar Threads

  1. Replies: 17
    Last Post: Dec 29, 2012, 6:25 AM
  2. [CLOSED] How to change theme from the client side
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Jul 19, 2012, 7:49 PM
  3. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  4. [CLOSED] Change fieldLabel on client-side
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 28, 2010, 5:18 PM
  5. Replies: 0
    Last Post: Jul 09, 2010, 4:19 PM

Posting Permissions