The stateEvents are only triggered when the state is saved. More important is which properties to save.
Setting the grid to stateful should handle the sorting of your columns. When something additional needs to be done you can customise the getState and setState functions of a component. I think you will find more answers about this on Sencha's forum.
but it's for only these columns that are defined in the app,
I mean by columns property.
Scenario1 (I've used fiddle app for testing from examples dir)
1. click on Duration column action icon (arrow down) - to hide it (uncheck for col list)
2. refresh;
3. it will be hidden
4. 1. click on Duration column action icon (arrow down) - to show it (check for col list)
5. refresh
6. the duration column will be visible;
Scenario2
same 1-3 steps
4. click add new column - and pick duration to show duration column
5. refresh;
6. no change - duration col is not visible
but
if we
7. click on start and check Duration column on
8. hmm now I see 2 duration options - why?
two Duration cols, why?
Screen Shot 2018-10-10 at 15.02.40.png (29.9 KiB) Viewed 9438 times
imho add new column should simple activate if column already exists in the list (hidden) - but that's my 2c
I'm not sure how to make add new columns to save the state.
Sencha tells that if property is changed - then the state is saved in the "storage".
I don't see how new columns is affecting columns property - since it doesn't trigger state manger to save the state.
Shouldn't adding new column at least triggers columnchanged,columnshow event?
"Add new column" just adds a new instance of a column to the grid. You can have as many columns with the same xtype as you wish. Since default column title is the same you see 2 duration columns in the dropdown list. But in fact they are 2 different columns. "Add new column" feature shouldn't affect the process of saving the column state.
I'm afraid saving the column state is a bit out of the scope of this forum, it's better to ask for a solution on Sencha forums.
I assume you are looking at Advanced sample and using column set from the sample. To simplify your application you can try to remove 'addnewcolumn' from the columns definition.