ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Persisting column config issue

Open shash8787 opened this issue 11 years ago • 5 comments

I'm looking to persist the column config by using localstorage but the problem is if I have the selection checkbox within the columns, it keeps on adding the checkbox whenever I refresh the page. Is there a way I can remove the checkbox from the column config?

Thanks

shash8787 avatar Jun 17 '15 15:06 shash8787

I had sort of the same problem, and since the checkboxes column has a precise name i find it and skip it. I hope that can help you.

lpand avatar Jun 17 '15 18:06 lpand

How do you skip it? The column name for the checkbox column is a tick mark.

shash8787 avatar Jun 17 '15 19:06 shash8787

If with column config you meant column definitions, this is what i do

gridApi.grid.columns.filter(function noCheckboxes(col) {
      return col.name !== 'selectionRowHeaderCol'
}).map(function copyCol(col) {
     var colDef = col.colDef
     // ...
})

lpand avatar Jun 18 '15 09:06 lpand

Thanks for your help. I was able to implement it in ng-grid. Now I'm moving to ui-grid. How can I do this w/o asking the user to save and restore states?

Like the user moved columns. When comes back to this page, he should see the changed order of columns in the grid. This needs to be done for everything, ie, grouping, column show/hide etc

shash8787 avatar Aug 26 '15 19:08 shash8787

Actually, there's a better and straightforward way to get those columns which is getOnlyDataColumns.

To answer your question, you could simply set listeners for any event of interest. E.g. groupingChanged event.

lpand avatar Aug 26 '15 22:08 lpand