PDA

View Full Version : [CLOSED] GridPanel with grouping and expand/collapse issue



ATLAS
May 09, 2014, 12:05 PM
Hi Guys,
I have a GridPanel which has grouping and also expand/collapse all functionality. Initial render of the grid is correct but I find that the expand/collapse causes the grouping headers to be rendered incorrectly. I can demonstrate this using your GridPanel -> GridPanel_Commands -> Group_Command MVC example. If you add the following code to the example Index.cshtml, you can see what I mean.

Add a top bar with the expand/collapse buttons :-



.TopBar(
Html.X().Toolbar()
.Flat(true)
.Items(
Html.X().ToolbarFill(),

Html.X().Button()
.Icon(Icon.BulletPlus)
.Text("Expand All")
.Handler("this.up('gridpanel').getView().getFeature('UserCom pElementsGrouping').expandAll();"),

Html.X().Button()
.Icon(Icon.BulletMinus)
.Text("Collapse All")
.Handler("this.up('gridpanel').getView().getFeature('UserCom pElementsGrouping').collapseAll();"),

Html.X().ToolbarSpacer().Width(30)
)
) /* -- end of top bar items -- */



Then give the Features -> Grouping an ID as used in the handler above :-



.Features(
Html.X().Grouping()
.ID("UserCompElementsGrouping")
.HideGroupedHeader(true)
.GroupHeaderTplString("{columnName}: {name} ({[values.rows.length]} {[values.rows.length > 1 ? \"Items\" : \"Item\"]})"),

Html.X().RowBody().GetAdditionalData("getAdditionalData"),

Html.X().RowWrap()
)


Refresh the page and click the expand/collapse buttons.

Daniil
May 09, 2014, 2:41 PM
Hi @ATLAS,

Please look at the screenshots here.
http://forums.ext.net/showthread.php?33091

Is it the same issue?

ATLAS
May 12, 2014, 7:57 AM
Hi @ATLAS,

Please look at the screenshots here.
http://forums.ext.net/showthread.php?33091

Is it the same issue?



It is not quite the same. Using the Ext.Net example. On initial render you get :-

10741

If you then expand all :-

10751

The if you collapse all you get :-

10761


If you collapse each group individually then all is OK.

Daniil
May 12, 2014, 8:22 AM
Ok. Though, I think there is the same reason. A Grouping and a RowBody cannot be used together. Sorry for the inconvenience.

ATLAS
May 12, 2014, 11:19 AM
Ok. Though, I think there is the same reason. A Grouping and a RowBody cannot be used together. Sorry for the inconvenience.

OK, as a workaround, what would be the best way to iterate the group and cause a group expand/collapse individually from "expandAll / collapseAll" buttons click handlers? I assume I can do that.

Daniil
May 12, 2014, 4:05 PM
I think it is what the expandAll method already does. It iterates the groups and expand each.
http://docs.sencha.com/extjs/4.2.1/source/Grouping.html#Ext-grid-feature-Grouping-method-expandAll