PDA

View Full Version : is it possible to automatically select Tree node using some flag in returning json?



whalethewise
8 Dec 2011, 7:46 AM
Hi,

Is there any flag I can set on node to make it selected after loading? I know there is "checked" flag to show check box. Is there some kind of "selected" flag?

Thanks

tvanzoelen
8 Dec 2011, 8:41 AM
Not that I know of. Maybe you can flag checked or make your own property in the data and select the inserted node with a listener on the iteminsert function of the treepanel.

If a node comes in with the flag on, select it with the selectionmodel.

whalethewise
8 Dec 2011, 1:11 PM
iteminsert doesnt fire when I load the entire store by one call

tvanzoelen
9 Dec 2011, 12:42 AM
Hmm I see. Maybe it was bad for the performance

But the load event on the TreeStore works. So you could return a JSON format like this



{success: true, total: 0, select_id: 'node2', data: [{node: 'node1', id:'node1' }, {node: 'node2', id:'node2' }]}


select_id: 'node2' can be accessed because the first callbackparamter of the load event is the store.



var select = store.proxy.reader.rawData.select_id;