程序設(shè)置Extjs樹中CheckBox的選中和取消選中設(shè)置
Posted on 2008-08-20 14:36 沙漠中的魚 閱讀(8829) 評論(0) 編輯 收藏 所屬分類: javascript在Extjs中treepanel中樹節(jié)點為checkbox類的節(jié)時,有時候我們需要用程序來設(shè)置他的選中和取消選中狀態(tài)
var nodes=tree.getChecked();
if(nodes && nodes.length){
for(var i=0;i<nodes.length;i++){
//設(shè)置UI狀態(tài)為未選中狀態(tài)
nodes[i].getUI().toggleCheck(false);
//設(shè)置節(jié)點屬性為未選中狀態(tài)
nodes[i].attributes.checked=false;
}
}
這樣通過獲取已選擇的節(jié)點,用程序取消選擇狀態(tài)
反之可以設(shè)置未選中節(jié)點選中狀態(tài)