user1288005
user1288005

Reputation: 920

How to provide Disclosure button only for a subset of items in a List?

I have a requirement in which I need to add the disclosure button only for some of the items in a Sencha List . Any idea on how this can be done?

Setting onItemDisclosure to TRUE enable this option for all items in the list. But I want to enable it only for a subset based on certain conditions.

Any help is deeply appreciated.

Upvotes: 2

Views: 229

Answers (1)

wantok
wantok

Reputation: 995

Use List's disclosureProperty. From the docs:

A property to check on each record to display the disclosure on a per record basis. This property must be false to prevent the disclosure from being displayed on the item.

Defaults to: 'disclosure'

So adding field called disclosure to your model should be all you need to do.

Ext.define('MyModel', {
    extend:'Ext.data.Model',

    fields:[//other fields
        {
            name:'disclosure',
            convert: function(value, record){
                // logic to determine if disclosure should be displayed.
                // return Boolean value
            }
        }
    ]
});

Upvotes: 1

Related Questions