關(guān)于extjs treepanel復(fù)選框選中父節(jié)點(diǎn)與子節(jié)點(diǎn)的問(wèn)題
更新時(shí)間:2013年04月02日 15:06:02 作者:
實(shí)現(xiàn)帶有復(fù)選框的樹(shù),選中父節(jié)點(diǎn)時(shí),選中所有子節(jié)點(diǎn)。取消所有子節(jié)點(diǎn)時(shí),才能取消根節(jié)點(diǎn),感興趣的朋友可以了解下本文

extjs 如圖,實(shí)現(xiàn)帶有復(fù)選框的樹(shù),選中父節(jié)點(diǎn)時(shí),選中所有子節(jié)點(diǎn)。取消所有子節(jié)點(diǎn)時(shí),才能取消根節(jié)點(diǎn)。
復(fù)制代碼 代碼如下:
var Fpanel = new Ext.tree.TreePanel({
id:'ptree',
region:'west',
layout:'anchor',
border:false,
rootVisible: false,
root:new Ext.tree.AsyncTreeNode({}),
listeners:{
"checkchange": function(node, state) {
if (node.parentNode != null) {
//子節(jié)點(diǎn)選中
node.cascade(function(node){
node.attributes.checked = state;
node.ui.checkbox.checked = state;
return true;
});
//父節(jié)點(diǎn)選中
var pNode = node.parentNode;
if (state || Fpanel.getChecked(id, pNode) == "") {
pNode.ui.toggleCheck(state);
pNode.attributes.checked = state;
}
}
}
}
});
authorityTree(Fpanel);
var authorityTree = function(Fpanel){
Ext.Ajax.request({
url: 'authorityTree.ashx',
method:'get',
success: function(request) {
var data = Ext.util.JSON.decode(request.responseText);
Fpanel.getRootNode().appendChild(data);
Fpanel.getRootNode().expandChildNodes(true);
Fpanel.expandAll();
},
failure: function() {
Fpanel.render();
Ext.MessageBox.show({
title: '提示',
msg: '服務(wù)器忙,請(qǐng)使用火狐瀏覽器瀏覽或稍后重試!',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
}
});
}
您可能感興趣的文章:
- vue基于element-ui的三級(jí)CheckBox復(fù)選框功能的實(shí)現(xiàn)代碼
- vue+element UI實(shí)現(xiàn)樹(shù)形表格帶復(fù)選框的示例代碼
- vuejs+element UI table表格中實(shí)現(xiàn)禁用部分復(fù)選框的方法
- element的el-tree多選樹(shù)(復(fù)選框)父子節(jié)點(diǎn)關(guān)聯(lián)不關(guān)聯(lián)
- el-table?選中行與復(fù)選框相互聯(lián)動(dòng)的實(shí)現(xiàn)步驟
- Vue3+ElementUI 多選框中復(fù)選框和名字點(diǎn)擊方法效果分離方法
- 使用element組件table表格實(shí)現(xiàn)某條件下復(fù)選框無(wú)法勾選
- Vue el-table復(fù)選框全部勾選及勾選回顯功能實(shí)現(xiàn)
- el-table表格點(diǎn)擊該行任意位置時(shí)也勾選上其前面的復(fù)選框
相關(guān)文章
Extjs學(xué)習(xí)筆記之九 數(shù)據(jù)模型(上)
本文開(kāi)始進(jìn)入Extjs最核心最優(yōu)秀的部分。2010-01-01extjs 時(shí)間范圍選擇自動(dòng)判斷的實(shí)現(xiàn)代碼
這篇文章主要介紹了extjs 時(shí)間范圍選擇自動(dòng)判斷的實(shí)現(xiàn)代碼,需要的朋友可以參考下2014-06-06ExtJS 2.0實(shí)用簡(jiǎn)明教程 之Border區(qū)域布局
Border布局由類Ext.layout.BorderLayout定義,布局名稱為border。2009-04-04Extjs中的GridPanel隱藏列會(huì)顯示在menuDisabled中解決方法
在Extjs中的GridPanel會(huì)有這樣的情況,隱藏列會(huì)顯示在menuDisabled中,但是這個(gè)一般沒(méi)有什么用處,只是用于后臺(tái)取值的作用,感興趣的朋友可以了解下啊,希望本文對(duì)你有所幫助2013-01-01Extjs中TabPane如何嵌套在其他網(wǎng)頁(yè)中實(shí)現(xiàn)思路及代碼
Extjs中TabPane在一些特殊用途時(shí)把其嵌在其他的網(wǎng)頁(yè)中,很多新手朋友可能對(duì)此不是很熟悉,小編就在本文章中詳細(xì)的介紹一下,感興趣的你可不要錯(cuò)過(guò)了啊,希望本文對(duì)你有所幫助2013-01-01Ext JS框架中日期函數(shù)的用法及日期選擇控件的實(shí)現(xiàn)
Ext JS中的Ext.Date可以看作是JavaScript中date的加強(qiáng)版,提供了許多進(jìn)階的日期操作函數(shù),下面我們就來(lái)看一下Ext JS框架中日期函數(shù)的用法及日期選擇控件的實(shí)現(xiàn)2016-05-05ExtJS 2.0實(shí)用簡(jiǎn)明教程之應(yīng)用ExtJS
應(yīng)用extjs需要在頁(yè)面中引入extjs的樣式及extjs庫(kù)文件2009-04-04