-
15 Dec 2011 2:02 PM #1
Unanswered: Nested List with Disclosure only on Leaf
Unanswered: Nested List with Disclosure only on Leaf
Currently I am using the getItemTextTpl configuration of the Ext.NestedList to check whether the record is a leaf. If it is I modify the template to include an element with "x-list-disclosure" as the class. This works, but is messy.
Is there a way to use onItemDisclosure and only have it create disclosure icons on leaf items?
Thanks
-
15 Dec 2011 4:11 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
Inspect the DOM... is there a CSS change between if a row is a leaf or not? You may be able to hide the icon via CSS.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
15 Dec 2011 4:33 PM #3
Not Leaf
LeafHTML Code:<div class="x-list-item"> <div class="x-list-item-body"><span>Today</span></div> <div class="x-list-disclosure"></div> </div>
I don't think there is a selector that can findHTML Code:<div class="x-list-item"> <div class="x-list-item-body"> <span class="x-list-item-leaf"> <div class="leaf-node"> <span>Torrance</span> </div> </span> </div> <div class="x-list-disclosure"></div> </div>
fromHTML Code:.x-list-disclosure
.HTML Code:.x-list-item-leaf
Thanks for the idea. I'll play around with it some more.Last edited by sissonb; 15 Dec 2011 at 4:34 PM. Reason: edit html
-
16 Dec 2011 5:14 PM #4
So what I ended up doing is adding 2 listeners to the nested list component that adds the class leafList when all the nodes are leafs and branchList when there is a node with children in the list. Then I use some CSS to hide the buttons.
Here's the relevant JS and CSS.
Code:cardswitch:function(list, newCard, oldCard, index, animated) { var isLeaf = true; newCard.store.each(function(record, index, records) { if (!record.get('leaf')) { isLeaf = false; } }); if (isLeaf) { this.addCls('leafList'); this.removeCls('branchList'); } else { this.addCls('branchList'); this.removeCls('leafList'); } }Code:render:function(list) { this.addCls('branchList'); }HTML Code:.branchList .x-list-disclosure{ display: none;}


Reply With Quote