Hello,
I have implemented server side sorting and paging in Ignite Grid (using MVC wrappers). I need to sort by a specific column using the Grid's API. At the same time I need to jump to a specific Page Index using the Grid's API.This causes two service calls; which I need to avoid.
How can I make the Grid to go to the server only once for these two operations?
One work-around that I ve already tried was to return false from the dataBinding event for the sorting and then return true when setting the page index. But, this doesn't work - the sorting information is not sent to the server.
NOTE: In near future I also need to filter the Grid using the API; and I would want to generate only a single call to the server for all these three operations. So, I am in a big need of a solution to this problem.
Urgent help shall be appreciated.
Regards,
Arfan Baig
Hello Arfan,
You can use $.ig.DataSource.urlParamsEncoding handler in order to modify any remote feature parameters.
For more details you can check the following forum post: http://ko.infragistics.com/community/forums/p/75870/383316.aspx#383316
Hope this helps,Martin PavlovInfragistics, Inc.
Hello Martin,
Thanks for providing the solution.
I have created the dataSource object as you have suggested. But, since I am using the MVC wrapper, I am not sure how do I use this dataSource object. I have tried the following but its doesn't seem to work:
var ds = new $.ig.DataSource({ dataSource: url, responseDataKey: "Source", urlParamsEncoding: function (owner, params) { owner.settings.sorting.expressions.push({ fieldName: "Name", dir: "desc" }); owner.settings.paging.pageIndex = 1; return true; } }); $(gridSelector).igGrid("option", "dataSource", ds); $(gridSelector).igGrid("dataBind"); Is it the right approach? Please note that I can't set the dataSource object to while initializing since I am already using the DataSourceUrl there. Also, I need to apply these operations only once at the page load only.
Please suggest what should I do to get it working?
Secondly, I was wondering if I can get the urlParamsEncoding event when I have used the DataSourceUrl in my Grid (using MVC Wrapper)?