igniteui-angular
igniteui-angular copied to clipboard
[igxPivot] Integration with igxGridState directive to store config.
Closes #11741
Additional information (check all that apply):
- [ ] Bug fix
- [x] New functionality
- [ ] Documentation
- [ ] Demos
- [ ] CI/CD
Checklist:
- [x] All relevant tags have been applied to this PR
- [x] This PR includes unit tests covering all the new code (test guidelines)
- [x] This PR includes API docs for newly added methods/properties (api docs guidelines)
- [ ] This PR includes
feature/README.MD
updates for the feature docs - [ ] This PR includes general feature table updates in the root
README.MD
- [x] This PR includes
CHANGELOG.MD
updates for newly added functionality - [ ] This PR contains breaking changes
- [ ] This PR includes
ng update
migrations for the breaking changes (migrations guidelines) - [x] This PR includes behavioral changes and the feature specification has been updated with them
@hanastasov @ChronosSF @dkamburov I've updated the specification of the Grid State Persistence with information on persisting a PivotGrid state. I've also updated the known issues. Please review it when you have the chance.
@hanastasov @ChronosSF @dkamburov I've updated the specification of the Grid State Persistence with information on persisting a PivotGrid state. I've also updated the known issues. Please review it when you have the chance.
I did, IMO is written well and clear - it made sense to me even though I have not worked with the pivot yet.
@MayaKirova Everything looks perfect to me except that I thought of noop pivot grid. What are we doing with this. Probably most of the customers would use some strategy that extends NoopPivotDimensionsStrategy
. Should we expose one more event where we can set both strategies because they are not persisted in the current configuration state? We can also set NoopPivotDimensionsStrategy
as default one if the user forgets about this. Have you thought anything about that or we just missed it while talking about pivot state feature?
@mddragnev @dkamburov I don't think we have discussed persisting/re-setting custom strategies. Not sure if there's such a mechanism in the base grid for custom sort/filter strategies either. @hanastasov is there any way in the base grid to set back a custom filterStrategy
/sortStrategy
after restoring a previous state from a string? If not then maybe we should add some event or events for strategies since for fully remote scenarios all strategies will need to be set again.
@MayaKirova @mddragnev @hanastasov Let's do a meeting about it and discuss restoring the strategies next sprint.
@mddragnev @dkamburov I don't think we have discussed persisting/re-setting custom strategies. Not sure if there's such a mechanism in the base grid for custom sort/filter strategies either. @hanastasov is there any way in the base grid to set back a custom
filterStrategy
/sortStrategy
after restoring a previous state from a string? If not then maybe we should add some event or events for strategies since for fully remote scenarios all strategies will need to be set again.
Strategies are class references so fall under the limitations I believe and need to be set with application code. Will try to prepare an example for the meeting.
@mddragnev @dkamburov @hanastasov I have added a new event for the igxGridState directive that can be used to modify the state before applying it when it is passed as a string. Changelog and tests are also updated.
@MayaKirova
The new approach with the strategies looks very good to me. One thing I noticed in the noop pivot sample is that if we run the exact sample you have pushed (with stringified state) - saving the initial state of the grid, removing all row dimensions and then restoring the state works fine. Once I decide to use IGridState
on application level - create a public state variable and set it like this in the saveState
method - this.state1 = this.state.getState(false);
and then when restoring having this logic to restore the state
this.state1.sorting.forEach(x => x.strategy = NoopSortingStrategy.instance());
this.state1.pivotConfiguration.rowStrategy = NoopPivotDimensionsStrategy.instance();
this.state1.pivotConfiguration.columnStrategy = NoopPivotDimensionsStrategy.instance();
this.state.setState(this.state1);
The same steps from above does not lead to restoring the rows.
@mddragnev Issue should be fixed now.