-
12 Jul 2012 6:51 AM #1
expandAll methd for partially expanded tree
expandAll methd for partially expanded tree
It looks like the expandAll() method does not work when a tree in a Ext.tree.Panel is partially expanded already. We are using EXTJS v4.0.7. Is this an issue in v4.0.7? How about if we upgrade it to the newest v4.1.1?
-
12 Jul 2012 10:13 PM #2
Hi,
Try following code its working fine at my end in Extjs4.x
Code:var store = Ext.create('Ext.data.TreeStore', { root: { expanded: true, children: [ { text: "detention", leaf: true }, { text: "homework", children: [ { text: "book report", leaf: true }, { text: "alegrbra", leaf: true} ] }, { text: "homework", children: [ { text: "book report", leaf: true }, { text: "alegrbra", leaf: true} ] }, { text: "buy lottery tickets", leaf: true } ] } }); Ext.create('Ext.tree.Panel', { title: 'Simple Tree', width: 200, height: 150, store: store, rootVisible: false, tbar: [ { xtype: 'button', text: 'Button 1', handler:function(btn){ btn.ownerCt.ownerCt.expandAll(); } } ], renderTo: Ext.getBody() });sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
13 Jul 2012 4:25 AM #3
Thank you sword-it for your test code. Your store works in my end, too. However, when I added two childern under the "algebra" (algebra I & II) then they cannot be expanded in a partially expanded tree.
So it looks this is an issue if the tree store has multi-layer of children (grandchildren of grandchildren).
Below is my store merely with algebra I & II added:
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", children: [
{ text: "algebra I", leaf: true },
{ text: "algebra II", leaf: true }
]}
] },
{ text: "homework", children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});


Reply With Quote