-
16 Oct 2011 7:50 PM #1
Unanswered: How to hide disclocure button on some of list items?
Unanswered: How to hide disclocure button on some of list items?
I really need a help to hide disclosure button for some items of a List.
e.g. I want to hide the disclosure button for items with id = 0 (The items are from stores and each record have ID). Setting "false" for onItemDisclosure will make disclosure button on all item hidden.
I've tried something like this:
onItemDisclosure: function (record) {if (record.getId() != 0 ) {
// do something
// let the disclosure button show
} else {
return false;
}}
but it's not working. The disclosure button always shown.
Can anyone please help me with this ?
Thanks in advance.
-
16 Oct 2011 8:23 PM #2Sencha Premium Member
- Join Date
- May 2008
- Location
- Pasadena, California
- Posts
- 172
- Vote Rating
- 2
- Answers
- 27
You would need to override the tpl that has been configured for the listed items in the initComponent method of Ext.List
this snippet of code from Ext.List.initComponent has configured the list item tpl and if onItemDisclosure is true, it adds the class to each list item. You would need an if condition inside this tpl such that based on data perhaps, you included or excluded the x-list-disclosure class. Take a look at XTemplate for examples of adding if conditions to the tpl definition
the other option may be to attempt to add your distinguishing logic to css3Code:this.tpl = '<tpl for="."><div class="x-list-item ' + this.itemCls + '"><div class="x-list-item-body">' + this.itemTpl + '</div>'; this.tpl += '<div class="x-list-status"></div>'; this.tpl += '<div class="x-list-analysis"></div>'; if (this.onItemDisclosure) { this.tpl += '<div class="x-list-disclosure"></div>'; } this.tpl += '</div></tpl>'; this.tpl = new Ext.XTemplate(this.tpl, memberFnsCombo);
-
5 Dec 2011 1:43 AM #3


Reply With Quote