3

如何使用复选框插件从 jstree 获取已检查 ID 的列表?

4

4 回答 4

0
var result = new Array();
$(".jstree-checked").each(function(i, element){
    result[i] = $(element).attr("id");
}); 
于 2011-01-28T18:37:37.493 回答
0
var arr = new Array();
var i = 0;
$('#dtree_region li').filter('.jstree-checked').each(function(){
                     arr[i] = $.makeArray($(this).attr("id"));
                    //  sel_id = sel_id + ',' + $(this).attr("id");
                        i++;
                        });
var sel_id = arr.join(",");
于 2012-02-08T09:31:50.530 回答
0

//static.jstree.com/3.3.11/assets/dist/jstree.min.js 我正在使用

var ids = new Array();
$(".jstree-clicked").each(function(i, element){
   ids[i] = $(element).parent('li.jstree-node ').attr('id');
});

节点:

<li role="none" id="91" class="jstree-node  jstree-closed" aria-selected="true">
  <div unselectable="on" role="presentation" class="jstree-wholerow jstree-wholerow-clicked">&nbsp;</div>
  <i class="jstree-icon jstree-ocl" role="presentation"></i>
  <a class="jstree-anchor jstree-clicked" href="#" tabindex="-1" role="treeitem" aria-selected="true" aria-level="1" aria-expanded="false" id="91_anchor" style="touch-action: none; user-select: none;">
    <i class="jstree-icon jstree-checkbox" role="presentation"></i>
    <i class="jstree-icon jstree-themeicon" role="presentation"></i>Аксессуары</a>
</li>
于 2021-06-08T19:48:18.030 回答
-1

http://www.jstree.com/documentation/checkbox

.get_checked ( context, get_all ), .get_unchecked ( context, get_all )

(在该页面的底部)

于 2011-08-04T13:34:26.753 回答