[英]How to disable collapsing in a grouped grid in ExtJS?
Everything's in the subject. 一切都在主题中。 I have a grouped grid, like this Sencha example .
我有一个分组网格,例如这个Sencha示例 。 I would like to remove the [+][-] signs in order to disable collapsing.
我想删除[+] [-]符号以禁用折叠。
I thought there would be some config for the grouping feature, something like 'collapsible: false', but there is not any. 我认为分组功能会有一些配置,例如“可折叠:假”,但没有任何配置。
Any ideas please ? 有什么想法吗?
Use configuration to disable collapse config property. 使用配置禁用崩溃config属性。 From Sencha:
从煎茶:
collapsible : Boolean
可折叠:布尔
Set to false to disable collapsing groups from the UI.
设置为false可从UI禁用折叠组。
This is set to false when the associated store is buffered.
缓冲关联存储时,将其设置为false。
Defaults to: true
默认为:true
Source: Sencha Documentation of the collapsible
configuration . 来源:
collapsible
配置的Sencha文档 。
You can inherit Ext.grid.feature.Grouping and redefine onGroupClick method. 您可以继承Ext.grid.feature.Grouping并重新定义onGroupClick方法。 It's not good but the simplest way for now:
不好,但是目前最简单的方法是:
Ext.define( 'My.grid.feature.RightsGrouping', {
extend: 'Ext.grid.feature.Grouping',
onGroupClick: function(view, group, idx, foo, e) {
}
});
Also you'll have to edit CSS to remove collapse sign and change cursor pointer: 另外,您还必须编辑CSS来删除折叠符号并更改光标指针:
.x-grid-group-hd .x-grid-cell-inner { cursor: default; }
.x-grid-group-title { background-image: none; }
Very nice Serg, thanks. 非常好的Serg,谢谢。
even easier for the override is: 覆盖更容易的是:
...
features: [
Ext.create('Ext.grid.feature.Grouping',{
onGroupClick: function() {} /* do nothing! */
})
]
...
This was not working in 4.2.1. 这在4.2.1中不起作用。
Figured out a solution seemed very funny to me 想出一个解决方案对我来说似乎很有趣
...
groupcollapse:
{
fn: me.onGroupingGroupcollapse,
scope: me
}
...
...
onGroupingGroupcollapse: function(view, node, group, eOpts)
{
Ext.getCmp('gridCenters').view.features[0].expand(node.name,true);
}
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.