View Full Version : How to provide Disclosure button only for a subset of items in a List?

11 Aug 2011, 11:28 PM

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.

16 Aug 2011, 5:14 AM
Hi !
Unfortunately Ext.list does not provide (as far as I know) a config option to enable/disable disclosure button.
But you have several ways to achieve that :

1. use CSS selector to hide it :

.x-list-item:nth-child(-n+2) .x-list-disclosure {
display: none;

2. override Ext.List.initComponent and add your own conditions inside this.tpl
this.tpl += '<div class="x-list-disclosure"></div>';
this.tpl += '<tpl if="!leaf"><div class="x-list-disclosure"></div></tpl>';

3. listen to 'itemtap' and filter disclosure action
if (sEvt.getTarget('.x-list-disclosure')) {
Ext.Msg.alert("Information", "There nothing behind this !")

Good luck !