jquery easyUI ComboTree使用心得

jquery easyUI ComboTree使用心得

   

繼承至 $.fn.combo.defaults和$.fn.tree.defaults.覆蓋默認值$.fn.combotree.defaults.

combotree結合選擇控制和下拉樹,類似於combobox只是替換了列表爲tree控件,combotree支持樹複選框,可以方便的實現多選


相關依賴

  • combo
  • tree

使用

從標記創建combotree 
使用javascript創建combotree 
$('#cc').combotree({url:'get_data.php',required:true});   

屬性

屬性繼承至 combo 和 tree, 以下是combotree重寫屬性.

Name Type Description Default
editable boolean 定義用戶是否可以直接輸入文本到選擇框. false

事件

事件繼承至 combo和 tree.

方法

方法繼承至 combo,以下是combotree新增和重寫的方法.

Name Parameter Description
options none 返回 options 對象.
tree none 返回樹(tree)對象. 以下示例展示如何得到選擇的樹節點(node).
var t = $('#cc').combotree('tree');      // 得到樹對象 
var n = t.tree('getSelected');          // 得到選擇的節點 
這裏經過實踐測試應該使用t.tree('getChecked');
alert(n.text);
loadData data 加載本地tree數據.

示例代碼:

$('#cc').combotree('loadData', [{
        id: 1,
        text: 'Languages',
        children: [{
                id: 11,
                text: 'Java'
        },{
                id: 12,
                text: 'C++'
        }]
}]);
reload url 重新請求遠程服務器端數據. 傳入'url'參數重寫原始的URL值.
clear none 清除組件值.
setValues values 設置組件值數組.

示例代碼:

$('#cc').combotree('setValues', [1,3,21]);
setValue value 設置組件值.

示例代碼:

$('#cc').combotree('setValue', 6); 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章