Closed LifeguardConcepts closed 7 years ago
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(<p-dataTable #table.... [expandedRows]="table.value")......by default all rows are expanding but when u click on collapse icon the row is getting removed ...can u please help me in that....??? Thanks in advance
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?