igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

[igxPivot] Integration with igxGridState directive to store config.

Open MayaKirova opened this issue 2 years ago • 8 comments

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

MayaKirova avatar Jul 14 '22 08:07 MayaKirova

@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.

MayaKirova avatar Jul 18 '22 08:07 MayaKirova

@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.

hanastasov avatar Jul 19 '22 14:07 hanastasov

@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 avatar Jul 21 '22 13:07 mddragnev

@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 avatar Jul 21 '22 15:07 MayaKirova

@MayaKirova @mddragnev @hanastasov Let's do a meeting about it and discuss restoring the strategies next sprint.

dkamburov avatar Jul 22 '22 11:07 dkamburov

@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.

hanastasov avatar Jul 25 '22 06:07 hanastasov

@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 avatar Aug 09 '22 14:08 MayaKirova

@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 avatar Aug 11 '22 08:08 mddragnev

@mddragnev Issue should be fixed now.

MayaKirova avatar Aug 11 '22 13:08 MayaKirova