EasyUi combotree 使用总结

EasyUi combotree



一、combotree加载方法

1、直接加载

  <input id="networkAreaOld"  class="easyui-combotree" data-options="url:'/yqkz/yqkzTaskRelease/getNet.do',method:'get',required:true" multiple style="width:200px;"></input>

2、js加载

<select id="networkAreaOld" class="easyui-combotree" multiple="true" onlyLeafCheck="true"  animate="true"  style="width:280px;"></select> 
//js加载数据 
$('#networkAreaOld').combotree({
        url:"/yqkz/yqkzTaskRelease/getNet.do", 
        method:'get',
    });

本编辑器支持 Markdown Extra ,  扩展了很多好用的功能。具体请参考[Github][2].

二、combotree的复选方法

combotree继承了combo和tree,所以很多方法继承自树。以复选方法为例:

1、combotree方法先要得到树,在获取复选中的节点。如下:

var t = $('#networkAreaOld').combotree('tree'); // 得到树对象 
//多选下拉
var nodes = t.tree('getChecked'); // 得到多个选择的节点
var nodes = $('#tt').tree('getChecked', 'unchecked');  // 获取多个未选择节点
var nodes = $('#tt').tree('getChecked', 'indeterminate');// 获取多个不确定的节点

//单选下拉
var n = t.tree('getSelected');      // 获取单个选择的节点

2、combotree复选当选中时调用方法onCheck:

$("#networkArea").combotree({
        onCheck:function(node, checked){
            if(checked == true){
                if(selectID==""){
                    selectID += node.id;
                }else{
                    selectID += "," + node.id;
                }

                if(selectData ==""){
                    selectData += node.text;
                }else{
                    selectData += "," + node.text;
                }
            }else if(checked == false){
                var arrayID = selectID.split(',');
                var arrayData = selectData.split(',');
                for(var i=0; i<arrayID.length; i++){

                }
            }

        }
    });

参考

easyUI官网:http://www.jeasyui.net

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章