PDA

View Full Version : Dynamicaly bind Treestore Ext js 4.2 ??



Vikram
16 Sep 2015, 3:38 AM
Hello there,

How to bind tree store dynamically ?
I have tried below approach but no success....


Ext.ComponentQuery.query('#AdminTree')[0].bindStore(dataobject);

waiting for reply

regards
vik

scottmartin
16 Sep 2015, 1:12 PM
Are you sure your query is returning valid?

This works fine:


var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "algebra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});

var tree = Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
// store: store,
rootVisible: false,
renderTo: Ext.getBody()
});

tree.bindStore(store);