PDA

View Full Version : Getting Selected Node model id except component id ?



zeeshanjeelani
9 Mar 2013, 1:01 PM
Hi,

I want to get model "id" of selected node, i set "id" while producing json.



var selDepNode= tree.getSelectionModel().getLastSelected(); alert(selDepNode.id);


it returns component id.

Thanks

zeeshanjeelani
10 Mar 2013, 1:31 PM
I found the solution, posting for future viewers of this post



var selectedNode = tree.getSelectionModel().getLastSelected();
//depid of the selected node declared in json
var depid= selectedNode.raw['depid'];
// pid of the selected node (parent id) declared in json

var unitid= selectedNode.raw['pid'];