Hi!
I'm using the getPersistData method for storing grid configuration in the database.
Here is the column definition:
The last column is just for placing icons and I don't want to persist it.
For now, I'm using a little workaround, just filtering columns where the 'field' property is not undefined.
Is there any approach to prevent persisting columns that are not bound to the dataset fields using an in-built way?
Thanks!
Hi Manivel!
Thank you for your reply!
I think that it's enough to answer only the first question because it completely covers my requirement :)
What do you recommend in this case?
Thanks!
|
// Button click function for storing Grid settings
btn1.element.onclick = function () {
savedProperties = Object.assign([], JSON.parse(grid.getPersistData()));
var gridColumnsState = Object.assign([], grid.getColumns());
savedProperties.columns.forEach( col => {
let headerText = gridColumnsState.find((colColumnsState) => colColumnsState.field === col.field)['headerText'];
let filterType = Object.assign({}, gridColumnsState.find((colColumnsState) => colColumnsState.field === col.field)['filter']);
let colTemplate = gridColumnsState.find((colColumnsState) => colColumnsState.field === col.field)['template'];
col.headerText = headerText;
col.filter = filterType;
col.template = colTemplate;
//likewise you can restore required column properties as per your wants.
})
} |