Hi
We are using the grid getOptions/setOptions to persist the users filters, column settings etc to a cookie
An issue we now have is it seems to persist everything including the datasource urls for read/update. This is an issue for us as we use custom MVC routes which look something like this: /jobs/1234/deliverable so the id is embedded into the url. When this is persisted the grid ends up querying data for a previously used Id.
What is the best way to prevent persisting the datasource url information and always use the URL as defined in the html page?
We have managed to get it working by doing this:
function
loadGridState(grid, sessionKey) {
var
options = localStorage[sessionKey];
if
(options) {
var
parsedOptions = JSON.parse(options);
parsedOptions.dataSource.transport.read = grid.dataSource.transport.options.read;
//dont persist datasource urls
grid.setOptions(parsedOptions);
}
}
Is there a better way to do this and is there anything else we should be preventing (e.g. update, delete) if this were to be a generic function for the entire project?
One other strange we noticed is the object stored from getOptions is a slightly different structure to that directly on the grid.
E.g. the Grid has dataSource.transport.options.read but the getOptions stores dataSource.transport.read
Thanks
Andy