有谁做过extjs有复选框的动态树
2个回答
展开全部
//*************************************************单位下拉框树开始******************************************************//
var UNITCODE = new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({ fields: [], data: [[]] }),
editable: false,
id: 'UNITCODE',
mode: 'local',
hiddenName: 'hidUNITCODE',
valueField: "value",
displayField: "text",
anchor: '90%',
//width: 120,
fieldLabel: '所属单位',
triggerAction: 'all',
maxHeight: 200, allowBlank: false,
tpl: "<tpl for='.'><div style='height:120px;' OVERFLOW-y:hidden><div id='singunittree'></div></div></tpl>",
selectedClass: '',
onSelect: Ext.emptyFn
});
var SingleUnitTree = new Ext.tree.TreePanel({
id: 'SingleUnitTree',
useArrows: true,
autoScroll: true,
height: 120,
animate: true,
containerScroll: true,
border: false,
frame: false,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode({ text: 'XX省电力公司', expanded: true, iconCls: 'group', id: '0' })
});
SingleUnitTree.on('click', function (node) {
UNITCODE.setValue(node.id);
UNITCODE.setRawValue(node.text);
document.getElementById("hidUnitId").value = node.id;
UNITCODE.collapse();
});
UNITCODE.on('expand', function () {
SingleUnitTree.render('singunittree');
});
var nodeAction1 = 0;
SingleUnitTree.on('beforeexpandnode', function (node, deep, anim) {//展开事件
nodeAction1 = 1;
});
SingleUnitTree.on('beforecollapsenode', function (node, deep, anim) {//收缩事件
nodeAction1 = 1;
});
UNITCODE.on('collapse', function () { //隐藏下拉列表事件
if (nodeAction1 == 1) {
this.expand(); //展开下拉列表方法
nodeAction1 = 0;
}
});
SingleUnitTree.on('beforeload', function (node) {
nodeAction1 = 1;
SingleUnitTree.loader.dataUrl = '../UnitManage/GetUnitTree.aspx'; //定义子节点的Loader
});
// Ext.getCmp('UNITCODE').listWidth ='90%'; //设置下拉框下面list宽度
//*************************************************单位下拉框树结束******************************************************//
var UNITCODE = new Ext.form.ComboBox({
store: new Ext.data.SimpleStore({ fields: [], data: [[]] }),
editable: false,
id: 'UNITCODE',
mode: 'local',
hiddenName: 'hidUNITCODE',
valueField: "value",
displayField: "text",
anchor: '90%',
//width: 120,
fieldLabel: '所属单位',
triggerAction: 'all',
maxHeight: 200, allowBlank: false,
tpl: "<tpl for='.'><div style='height:120px;' OVERFLOW-y:hidden><div id='singunittree'></div></div></tpl>",
selectedClass: '',
onSelect: Ext.emptyFn
});
var SingleUnitTree = new Ext.tree.TreePanel({
id: 'SingleUnitTree',
useArrows: true,
autoScroll: true,
height: 120,
animate: true,
containerScroll: true,
border: false,
frame: false,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode({ text: 'XX省电力公司', expanded: true, iconCls: 'group', id: '0' })
});
SingleUnitTree.on('click', function (node) {
UNITCODE.setValue(node.id);
UNITCODE.setRawValue(node.text);
document.getElementById("hidUnitId").value = node.id;
UNITCODE.collapse();
});
UNITCODE.on('expand', function () {
SingleUnitTree.render('singunittree');
});
var nodeAction1 = 0;
SingleUnitTree.on('beforeexpandnode', function (node, deep, anim) {//展开事件
nodeAction1 = 1;
});
SingleUnitTree.on('beforecollapsenode', function (node, deep, anim) {//收缩事件
nodeAction1 = 1;
});
UNITCODE.on('collapse', function () { //隐藏下拉列表事件
if (nodeAction1 == 1) {
this.expand(); //展开下拉列表方法
nodeAction1 = 0;
}
});
SingleUnitTree.on('beforeload', function (node) {
nodeAction1 = 1;
SingleUnitTree.loader.dataUrl = '../UnitManage/GetUnitTree.aspx'; //定义子节点的Loader
});
// Ext.getCmp('UNITCODE').listWidth ='90%'; //设置下拉框下面list宽度
//*************************************************单位下拉框树结束******************************************************//
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询