How i can retrieve value from selected node on Tree Panel

无人久伴 提交于 2019-12-11 05:19:00

问题


I use following methods :

var myobj = myTree.getSelectionModel().getSelection();

alert(myobj) // [Object object]

Now, i don't know what i can do it with this object. I supposed this Object have my value ? But i don't know how to use Object to retrieve values ... !

Thanks a lot :)


回答1:


First. Looking at the API, I think the method you are talking about is

// DefaultSelectionModel:
var myobj = myTree.getSelectionModel().getSelectedNode();

// MultiSelectionModel:
var myobj = myTree.getSelectionModel().getSelectedNodes();

which returns an object or array of type TreeNode.

Second. I will advice you to use a client side debug tool like FireBug or similar to actually see what you get when calling myTree.getSelectionModel().getSelection(). If the result is a TreeNode item then check the API for information about the different properties.

Hope it helps you :)



来源:https://stackoverflow.com/questions/6265570/how-i-can-retrieve-value-from-selected-node-on-tree-panel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!