Results 1 to 4 of 4

Thread: Selective display of list items, based on Xtemplate condition

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    2

    Question Selective display of list items, based on Xtemplate condition

    Hi,

    I have my store loaded with all data that i need.
    I need to display the store data in a list based on a condition.
    I am using xtemplate as my itemTpl to do this, like this.

    Code:
    productTemplate = new Ext.XTemplate(
        '<tpl if="partsSelected == true">', 
             '<tpl if="Product_type==&quot;01&quot;">',
                '<div class="product">{Description}</div>',
            '</tpl>',
        '</tpl>',
        '<tpl if="partsSelected == false">', 
            '<tpl if="Product_type ==&quot;02&quot;">',
                '<div class="product">{Description}</div>',
            '</tpl>',
        '</tpl>'
    );
    This doesn't work the way i want it to, it displays blank list items in the list, where the condition isn't satisfied.
    I want those items to be skipped, i.e not displayed at all.
    I am not able to use filter as I have a dynamic search for the list, which adds and clears filters on the store.
    Is there a way to do this?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    What do you not want to display that is?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    2

    Default

    the blank list item is what i do not want displayed, i want those items to be skipped if the condition given above is not satisfied.

    .Capture.JPG

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    You may want to switch to DataView then to get access to the tpl config.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

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
  •