-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Not sure if is just me doing something wrong or is there a bug with grouping with default expansion?
I also noticed that inputs groupRowsBy and groupExpansionDefault aren't described in current document?
https://swimlane.gitbook.io/ngx-datatable/api/table/inputs
I'm submitting a ... (check one with "x")
[ x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter
Current behavior
groupExpansionDefault is not respected when page is changed.
Expected behavior
groupExpansionDefault is respected when page is changed.
Reproduction of the problem
1. Set up
- External paging = true
- External sorting = true
- Default expansion = true
<ngx-datatable class="data-table" #table
[rows]="data"
[externalPaging]="true"
[externalSorting]="true"
[groupRowsBy]="groupkey"
[groupExpansionDefault]="true" ...>
2. Steps
- When page 0 is show by default -> groupExpansionDefault is respected (all groups are opened)
- Click page 1 -> groupExpansionDefault is NOT respected (all groups are closed)
I tried to debug the code.
It looked like table?.bodyComponent?.rowExpansions contained groups from page from page 0 -> Updating data does not update this.table?.bodyComponent?.rowExpansions for some reason?
I printed out data's group keys + keys from table?.bodyComponent?.rowExpansions.
Page 0:
data group keys: [ "1", "1", "2", "2", "3"]
row expansions: [ "1", "2", "3" ]
Page 1:
data group keys: [ "4", "4", "4", "5" ]
row expansions: [ "1", "2", "3" ]
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
-
Table version:
"@swimlane/ngx-datatable": "^20.1.0", -
Angular version:
Angular CLI: 16.1.5
Node: 16.17.0
Package Manager: npm 8.15.0
OS: win32 x64
Angular: 16.1.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.1601.5
@angular-devkit/build-angular 16.1.5
@angular-devkit/core 16.1.5
@angular-devkit/schematics 16.1.5
@angular/cdk 16.1.5
@angular/cli 16.1.5
@angular/google-maps 16.1.5
@angular/material 16.1.5
@angular/material-date-fns-adapter 16.1.5
@nguniversal/builders 16.1.1
@nguniversal/common 16.1.1
@nguniversal/express-engine 16.1.1
@nguniversal/module-map-ngfactory-loader v8.2.6
@schematics/angular 16.1.5
rxjs 7.8.1
typescript 5.1.6
zone.js 0.13.1
-
Browser:
Tested withChrome version 115.0.5790.98 (Official Build) (64-bit) -
Language:
typescript 5.1.6