Author Topic: Select in toolbar  (Read 1565 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Select in toolbar
« on: February 10, 2020, 07:12:20 pm »
Is it possible to include value of toolbar select in a state?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Select in toolbar
« Reply #1 on: February 10, 2020, 10:03:24 pm »
The API was not pre designed for it but I found it working.

First include the toolbar items in the state with stateKeys option.

Code: [Select]
stateKeys : { toolbar: ['items']}

Then during restoration of state, please add this besides call to loadState:

Code: [Select]
grid.option('toolbar').items[index of select item in the toolbar].value = JSON.parse(grid.getState()).toolbar.items[index of select item in the toolbar].value
grid.refreshToolbar();