Our blazing fast Grid component built with pure JavaScript


Post by ashupp »

Hello, i am using grid states to save column orderings.

My question is - how is it possible to re-apply the initial state after clearing the saved state.

Steps to clarify:

  1. open state example https://www.bryntum.com/examples/grid/state/
  2. change column ordering
  3. click save state
  4. reload page
  5. click restore state -> the state is restored and applied
  6. click clear state -> the state in localstorage is deleted and it would be visible after reload - but i want to change the view right now to the default like it was after step 1.

Is it possible to force "no initial state" to be applied?
like

this.$refs.grid.gridInstance.applyState({});

I would not want to store an additional "default state"

thank you and best regards,
Alex


Post by Maxim Gorkovsky »

Hello.
Yes, this is possible, only thing you need is a default state which matches initial state of the application. For example, you can try to save state to a variable right after you instantiate the grid. Or define it explicitly in your application.


Post by ashupp »

Thank you for hinting me. i was thinking too complicated.
Now i simply store the initial state of the grid before any saved state is being loaded and revert to this when resetting the state.
Works perfect. Thank you.


Post Reply