PDA

View Full Version : how to refresh a selected node in Ext.tree.Panel- Extjs 4.1.0



Ibrahimp
25 Jul 2012, 10:59 PM
Hi,

I want to refresh a selected node in Ext.tree.Panel. is it possible?

don't want to refresh(reload) entire tree, but only the selected node dynamically.

Thanks,
Ibrahim

Rovak
25 Jul 2012, 11:34 PM
Ext.data.TreeStore.load has a node option.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.TreeStore-method-load



var selectedNode = treePanel.getSelectionModel().getSelection()[0];

treePanel.getStore().load({ node: selectedNode })

dan.everest
31 Jul 2012, 2:37 PM
Are thre any examples as to what my JSON might look like when refreshing a single node? For example, if my regular JSON lookslike the following:


{
"name":"root",
"tree_id":"root_0",
"children": [{
"name": ", Cameron",
"customer_id": 25,
"tree_id": "customer_25",
"url": "/customers/25.json",
"current_bill": 0,
"children": [{
"name": "Dunlop 300g OS",
"id": 47,
"tree_id": "racket_47",
"url": "/customer_rackets/47",
"leaf": true,
"iconCls": "racquet-icon",
"customer_id": 25,
"lastStrungOn": "2011-05-22",
"current_bill": 0
}, {
"name": "Dunlop 300g OS",
"id": 48,
"tree_id": "racket_48",
"url": "/customer_rackets/48",
"leaf": true,
"iconCls": "racquet-icon",
"customer_id": 25,
"lastStrungOn": "2011-09-10",
"current_bill": 0
}]
}, {
... More Customers ...
}]
}
What would my JSON look like when returned by the server for the 'customer racket' with id=48 in order for 'store.load({node: record})' to work? So far, all the combinations I've tried do not work.

Thanks
Dan