Replies
Mike,
Thanks, but my question was not about getting, it was about restoring, as I said:
"is this the proper way to restore these filter expressions?"
And by that, I meant, is it the best option to do this in the "rendered" event handler of the grid, or, maybe it's better to use some other event handlers?
regards,
Peter
Mike.
Thanks, this way I can save and restore grid settings. However, I noticed that the fitler expressions (like: Name contains "blah", etc. ) don't get saved this way. I managed to get them by saving the following JSON:
var filteringExpressions = $("#CompaniesGrid").data("igGrid").dataSource.settings.filtering.expressions;
And then, restoring it in the igGrid "rednered" event handler like this:
$("#CompaniesGrid").igGrid({
rendered: function (evt, ui) {
$('#CompaniesGrid').igGridFiltering("filter", filteringExpressions);
}
});
This works properly for me, I posted this partly to let others know how this works, but party to ask you Mike, is this the proper way to restore these filter expressions? Or, is there a better way to do this?
regards,
Peter
Mike,
Thanks again.
Now, i'm considering to change from MVC initialization to jQuery initialization, to be able to set these settings directly, as you suggested:
"If you use JavaScript/jQuery to initialize the grid instead of the MVC wrappers you can put the settings you got before directly into the column settings property of the different grid features."
Could you please show me an example, how to do this in this case?
regards,
Peter
Mike,
Thanks for answering the first part of my question. However, I'm still waiting for the second answer:
"If I eventually have to implement this parsing, is there any resource about the structure of those JSONs? I'm afraid just clicking through the grid and checking the results wouldn't reveal all options that might be in them."
Could you pleas answer this as well?
regards,
Peter
Mike,
Thanks for the quick help. So, that means that I have to parse the JSONs I saved from the grid, and set those options one by one using C# code? I have very complex grids, I hoped for a more straightforward solution, where I don't have to care about the actual contents of the JSONs, just save and restore them as strings, and igGrid taking care of the rest. Are you sure that no such solution exists? Maybe not using the MVC wrappers, but using pure JS or jQuery?
It's kind of hard to believe that I can't import something that I just exported without parsing it myself.
If I eventually have to implement this parsing, is there any resource about the structure of those JSONs? I'm afraid just clicking through the grid and checking the results wouldn't reveal all options that might be in them.
regards,
Peter