我正在尝试将“全部折叠”和“全部展开”功能添加到具有分组功能的ExtJs网格
我添加了一个名为startCollapsed的属性为true,以便在网格加载时折叠所有组
添加startCollapsed:true后,要首次展开任何组,我必须双击该组。所以ExpandAll或Collapse All都不起作用。我做了一些研究,得到了相同问题的以下链接但是没有用
https://www.sencha.com/forum/showthread.php?208801
我的代码如下。
xtype: 'button',
text: 'Expand All',
handler: function (event, target, owner, tool)
{
var eFormsView = Ext.getCmp('gridId').getView();
var groupFeature = eFormsView.getFeature('groupSummary');
if (groupFeature.collapsedState['groupSummary'] === undefined && groupFeature.startCollapsed)
{
groupFeature.collapsedState['groupSummary'] = true;
}
grdItems = eFormsView.getEl().query('.x-grid-group-hd');
for(i=0;i<grdItems.length;i++)
{
var groupBody = Ext.fly(grdItems[i].nextSibling, '_grouping');
groupFeature.expand(groupBody);
}