Results 1 to 3 of 3

Thread: How to hide an item in a list with XTemplate ?

  1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    11

    Default How to hide an item in a list with XTemplate ?

    When i follow the docs "Conditional processing with basic comparison operators" ,i got an empty item,but i want to show these items conditional

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Answers
    130

    Default

    you can filter content of each list item when changing the item tpl using tpl if:
    Code:
            '<tpl if="age &gt;= 13">',
                '<p>teenager</p>',
            '<tpl elseif="age &gt;= 2">',
                '<p>kid</p>',
            '<tpl else>',
                '<p>baby</p>',
            '</tpl>',
    when you want to filter complete listitems, the template is not a good spot to do this.

    The better approach would be to apply a filter to the store of the list.
    http://docs.sencha.com/touch/2.2.1/#...ethod-filterBy

    Best regards
    tobiu
    Best regards
    Tobias Uhlig

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Posts
    11

    Default

    Quote Originally Posted by tobiu View Post
    you can filter content of each list item when changing the item tpl using tpl if:
    Code:
            '<tpl if="age &gt;= 13">',
                '<p>teenager</p>',
            '<tpl elseif="age &gt;= 2">',
                '<p>kid</p>',
            '<tpl else>',
                '<p>baby</p>',
            '</tpl>',
    when you want to filter complete listitems, the template is not a good spot to do this.

    The better approach would be to apply a filter to the store of the list.
    http://docs.sencha.com/touch/2.2.1/#...ethod-filterBy

    Best regards
    tobiu
    Thanks a lot for your help.
    My code is ?
    Code:
    '<tpl for="."><tpl if="visible == 1">{label}{value}</tpl></tpl>'
    how to make it ?

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
  •