EasyUI tree擴展獲取實心節點
阿新 • • 發佈:2019-01-30
eas sub mit 大神 -html rip html hid clas
<script type="text/javascript">
//擴展 獲得tree 的實心節點
$(function(){
$.extend($.fn.tree.methods,{
getCheckedExt: function(jq){
var checked = $(jq).tree("getChecked"); //獲取選中的選項 也就是打鉤的
var checkbox2 = $(jq).find("span.tree-checkbox2").parent(); //獲取實心的選項 也就是實心方塊的
$.each(checkbox2,function(){
var node = $.extend({}, $.data(this, "tree-node"), {
target : this
});
checked.push(node);
});
return checked;
}
});
})
/*
註: checkbox0是沒有被選中的
checkbox1是被選中打鉤的
checkbox2是實心節點
*/
function getSelect (){
var solids = $("#trueULid").tree("getCheckedExt");
var nodes = ‘‘;
$.each(solids,function(){
nodes+=this.id+‘,‘;
});
$("#typeRole").val(nodes); //將所有ID值保存
}
</script>
<input type="hidden" id="typeRole" name ="typeRole" value="" />
隱藏域保存所有樹節點ID傳入後臺
<input onclick="getSelect();" type="submit" value="提交" class="submit" class="submit" />
再分享一下我老師大神的人工智能教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智能的隊伍中來!https://blog.csdn.net/jiangjunshow
EasyUI tree擴展獲取實心節點