[英]How do i get children-attribute ID's in jsTree
首先,我對javascript很陌生,並嘗試使它工作數小時。
問:我正在使用帶有復選框的jsTree(請參閱此鏈接: http : //nuijten.blogspot.de/2013/07/apex-tree-with-checkboxes.html ),我想用ID為的數組填充所有已檢查的子代(2個層次樹,每個子代都有多個根)
我能做的最好的就是將所有ID(包括根的ID)放入數組中。
var lmetrics = [];
$("#metrics-tree a.checked, a.undetermined").parent()
.each(function()
{
lmetrics.push($(this).attr("id"));
});
在函數中也嘗試過這樣的事情:
if ($this.children("a").hasClass("checked"))
lmetrics.push($(this).attr("id"));
但是你猜我在犯一些重大錯誤
預先感謝,托馬斯
你可以試試這個嗎
var inst = $.jstree.reference('#yourTreeDiv');
var checkedNodes = inst.get_checked();
問候,
馬丁
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.