Author Topic: saveState issue  (Read 1670 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
saveState issue
« on: October 11, 2017, 01:53:47 pm »
I'm using a solution that allows the user to save and administrate different states.
Having one issue though:

1. User saves a state.
2. A new column is introduced and a new state is saved showing this column.
3. When user now switch back and loads the first state the new column from the second state is still visible (since it didn't exist when the state was created it has no information on it).

Any solution that could address this problem?
Is it possible to set some sort of default behaviour, if there is no information on column in state, hide it or similiar?
« Last Edit: October 11, 2017, 01:59:36 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: saveState issue
« Reply #1 on: October 11, 2017, 09:06:54 pm »
There is no such option.

However you could do it manually by reading the colModel from state, compare with colModel of the grid, hide/ show the extra columns as per your requirement.

var CM = JSON.parse(state).colModel; //state's colModel.

var CM2 = [{},{},...]; // grid's colModel