且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在jsTree中获取检查的节点

更新时间:2023-02-05 21:19:08

我找到了答案.通过调用$('#tree').jstree('get_json'),您可以获取整个树的JSON表示形式.从那里开始,直接遍历树节点并获取所有选中的节点是非常简单的.同样,这是针对3.0.0版本的(因为该API在各个版本之间似乎已经发生了很大变化).

I found an answer. By calling $('#tree').jstree('get_json'), you can get a JSON representation of the whole tree. From there it's pretty straight forward to recurse through the tree nodes and grab all the checked ones. Again, this is for version 3.0.0 (since it seems that the API has changed a lot across versions).