我的目的是禁用西部地区树视图的某些节点。
下面的代码片段显示了这一点:
root: {
expanded: true,
id: 'treeview1',
children: [
{"text": "Make Copy",
"leaf": true,
id:'HS1',
"**disabled**": true,
"**hidden**" : true}
]
}
为什么禁用和隐藏属性在 ExtJS 4 中不起作用。
有没有什么插件可以实现。
树面板中的节点是Ext.data.NodeInterface
对象。
它没有禁用或隐藏属性,但它有cls
这样你就可以添加一个display: none
隐藏节点的样式。
Example:
-
在CSS文件中:
.x-hidden-node {display: none !important;}
-
在extjs代码中:
root: {
expanded: true,
id: 'treeview1',
children: [{
text: 'Make Copy',
leaf: true,
id:'HS1',
cls : 'x-hidden-node'
}]
}
对于禁用的功能,您可以使用树面板的beforeitemclick
您可以在其中手动读取禁用属性的事件。
Example:
Ext.create('Ext.tree.Panel', {
(...)
listeners: {
beforeitemclick: function(treeview, record, item, index, e, eOpts) {
if (record.raw && record.raw.disabled == true) {
return false;
}
return true;
},
itemclick: function(treeview, record, item, index, e, eOpts) {
console.log(record, item);
}
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)