Primeng: Auto Expand Row Groups - Data Table

Created on 3 Jan 2017  路  8Comments  路  Source: primefaces/primeng

The docs mention that you can auto expand rows using the expandedRowGroups property of the DataTable. Does this work when using RowGroup and is there an example of what data needs to be added to the property?

Most helpful comment

The property is expandedRowsGroups not expandedRowGroups as stated in the documentation (note the "s" in "Rows"). You can bind this to an array in your component class.

For example:

<p-datatable ... [expandedRowsGroups]="groupHeaders">

In component class:
groupHeaders = ['group1','group2','group3'];

All 8 comments

Did anyone ever respond to you, or did you figure it out?

No, I haven't had a response yet on this. I poked around for a bit but didn't find a solution. It looks like you can specify it for Expandable Rows, "By default all rows are collapsed and expandadRows property needs to be populated with the row data instances to show particular rows as expanded by default." but I didn't see this property added for row grouping.

The property is expandedRowsGroups not expandedRowGroups as stated in the documentation (note the "s" in "Rows"). You can bind this to an array in your component class.

For example:

<p-datatable ... [expandedRowsGroups]="groupHeaders">

In component class:
groupHeaders = ['group1','group2','group3'];

I could not make it work.
I presume the groupHeaders array holds the field names used for grouping.

I made it work.
the groupHeaders array should hold group field values, not names.

@kcsahoo I know this issue is closed, but can you tell how you made it work - what are the group field values? Can you you perhaps show example?

Never mind. I wanted to expand all row groups by default. I managed to do this with the property value on the datable. For anybody who might be struggling with something similar, here's an example:

In the template:
<p-dataTable #table.... [expandedRows]="table.value"

@enshuti .....Thanks for that code( Thanks in advance

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

mitosandov picture mitosandov  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments

lilling picture lilling  路  3Comments

cyberrranger picture cyberrranger  路  3Comments