angularjs-table icon indicating copy to clipboard operation
angularjs-table copied to clipboard

Preserving table state

Open pwarelis opened this issue 7 years ago • 1 comments

Is there a way to export current column widths and display order so that the display options can be preserved?

pwarelis avatar Dec 11 '17 17:12 pwarelis

Yes, via the storage option. Looking back on it I realize that I need to improve the documentation around this feature. Basically you set an object to the storage option (on the table options object) that implements setItem, getItem, and removeItem. You will also need to set the storageKey option (this identifies the specific table instance). It's actually very easy to try it out because window.localStorage implements these three methods. So, just add this to your table options object:

scope.yourTableOptions = {
  // ... other options you might have ...
  storage: $window.localStorage,
  storageKey: 'myAwesomeTable'
}

I'll try to make an effort to improve documentation regarding this feature. Let me know if anything is unclear!

andyperlitch avatar Dec 13 '17 18:12 andyperlitch