Results 1 to 2 of 2

Thread: How to hide the Element in Xtemplate based on codition

  1. #1

    Default How to hide the Element in Xtemplate based on codition

    Hi,
    I am using the Extjs Version 6.5.

    I am Facing an issue with X Template.
    i.e i want hide the one div element based the other div element value.

    Below is my code.
    Code:
    itemTpl: new Ext.XTemplate(
                        '<tpl>',
                        '<div style="margin:0 0 10px 0; width: 100%; float: left;"><span style= "width:50%;float:left;font-weight:bold;color:#0071BC">Intelliscore Plus Score:</span><label style="float:left; width:50%;" title="{Intelliscore}">{Intelliscore}</label> </div>',
                        
                        '<div style="margin:0 0 10px 0; width: 100%; float: left;"><span style= "width:50%;float:left;font-weight:bold;color:#0071BC">Underwriting Action:</span><label style="float:left; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; width:50%;" title="{RecommendedAction}">{RecommendedAction}</label> </div>',
                        
                        '<div style="margin:0 0 10px 0; width: 100%; float: left;"><span style= "width:50%;float:left;font-weight:bold;color:#0071BC">Bankruptcy Action:</span><label style="float:left; width:50%;" title="{}"></label> </div>',
                        
                        '</tpl>'
                    )
    in the above code i want to hide Bankruptcy Action: div based the value of Underwriting Action:

    Please
    help me in this.


    Thanks
    Kamalakar Reddy V

  2. #2
    Sencha User
    Join Date
    Oct 2018
    Location
    Noida
    Posts
    67
    Answers
    10

    Default

    Hi,

    please check tpl-it and tpl-else in below URL -
    https://docs.sencha.com/extjs/6.5.0/...XTemplate.html

    check the code below -

    var tpl = new Ext.XTemplate(
    '<p>Name: {name}</p>',
    '<p>Kids: ',
    '<tpl for="kids">',
    '<p>{name} is a ',
    '<tpl if="age &gt;= 13">',
    '<p>teenager</p>',
    '<tpl elseif="age &gt;= 2">',
    '<p>kid</p>',
    '<tpl else>',
    '<p>baby</p>',
    '</tpl>',
    '</tpl></p>'
    );

Similar Threads

  1. Grouping results of XTemplate based on a field value
    By eng80327 in forum Ext: Discussion
    Replies: 0
    Last Post: 23 Jul 2011, 1:32 PM
  2. How to hide form element labels on hide()? SOLVED
    By borg in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 22 Jul 2009, 7:00 AM
  3. Element.hide() element.setVisible() & Element.show()
    By xnoor in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 6 Apr 2008, 12:23 AM
  4. element hide hide show bug
    By pomata in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 9 Dec 2006, 7:16 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •