- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.5k
 
Open
Description
Newly added columns are not getting restored. Follow the below steps to reproduce the issue,
- Add new column (Click Add)
 - save grid state in localstorage
 - Change state of grid but don't save state
 - Now restore grid state by clicking Restore button and this fetches settings from localstorage (working)
 - However refresh the browser.
 - Restore grid state from localstorage (Not working)
 
I have created plunker for this issue http://plnkr.co/edit/mR7lbG?p=preview
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
PaulL1 commentedon May 16, 2015  
I think the problem is that you're making an assumption that restore state will add columns that aren't there. Restore will only add settings to columns it can find - the base column needs to be there.
If you change the plunker such that the columns are there but hidden, then it works. http://plnkr.co/edit/c0Xwl8QWgS6RWr7aQUsX?p=preview
settysreekanth commentedon May 18, 2015  
@PaulL1 Thanks for your reply. I modified my plunker but I have to click restore button twice to restore my actual settings.
http://plnkr.co/edit/g6hGjz?p=preview
Steps:
3.Refresh the page and click restore state button twice to restore the actual state (i.e. to restore state including sorting on company column).
Here clicking restore state first time will restore columns and 2nd time will restore actual settings.
Could you please help me to find out the issue here?
settysreekanth commentedon May 21, 2015  
@PaulL1 could you please suggest if it is a bug on UI grid?
c0bra commentedon Jun 19, 2015  
@PaulL1 seems to me that restore state should restore everything at once if it's able to, would you agree?
PaulL1 commentedon Jun 19, 2015  
Yes, it should, but I suspect it's more a timing/usage issue. I'll take a look later today.
HarnikNoa commentedon May 17, 2016  
Was this issue ever resolved? I'm running into a similar issue, where it takes me two button clicks ("reset grid") to restore to the correct grid setting. The first restores (or clears, in this case) the filters, the second moves the columns back.