Assign Locally Stored jQgrid parameters to first call to server

147 Views Asked by At

I have seen following implementation of Localstorage of settings and need to implement this. I have come across the code from line 243-247 that

            gridview: true,
            page: isColState ? myColumnsState.page : 1,
            search: isColState ? myColumnsState.search : false,
            postData: isColState ? { filters: myColumnsState.filters } : {},
            sortname: isColState ? myColumnsState.sortname : 'invdate',
            sortorder: isColState ? myColumnsState.sortorder : 'desc',
            rownumbers: true,

As you can see this is nice approach as it checks on first load if isColState is true then choose parameters accordingly however with Lib.Web.MVC helper I am not able to do this at server side and can only put integers and lists as provided. I am looking at this wiki page and come across events like LoadBeforeSend, beforeRequest and beforeProcessing which may help me modify grid column model, its search and sort parameters and paging options etc before first request go out to server. After that it can simply keep updating local storage and so on. BeforeProcessing is not available in Lib.Web.Mvc library and I am not sure if there is an alternative.

Any ideas to solve this.

1

There are 1 best solutions below

1
On BEST ANSWER

Unfortunately there is no way to achieve what you want with current functionality of Lib.Web.Mvc. The closest ready to use functionality is wrapper around jqGrid import/export configuration functionality. Please refer to this demo project for more details:

If you want, you can rewritte the code of JqGridHelper class in order to fit your needs.

If you think this would be a valuable addition to the helper, please describe how would you see the feature and drop me an issue here, I will be happy to work on it.