I'm reading about igGrid remote paging here : http://help.infragistics.com/NetAdvantage/jQuery/2013.1/CLR4.0?page=igGrid_Paging.html.
However, it's still unclear to me how I setup my remote paging if I'm NOT using the IG wrappers.
Could someone advise me on how to use recordCountKey and responseDataKey to configure this ? How do I implement my c# page method on the server-side, is it through the grid's "pageIndexChanging" event ?
As per the link above, it says :
"If you are implementing your own remote service (for example in ASP.NET or PHP), in order to properly initialize and render the pager, your service must specify both the responseDataKey (grid option) and the recordCountKey (paging option). The recordCountKey member tells the Paging widget how many records in total are in the backend. The responseDataKey specifies which property in the response contains the resulting data.
Therefore, when remote paging is used, the grid automatically generates the proper request parameters in the following way:
http:///grid/PagingGetData?page=2&pageSize=25"
ex/
$("#imGrid").igGrid({ //dataSource: jsonData,
dataSource: "/Margins/getTrades?level=account&entityName=" + entityName, responseDataKey: "Data.data", columns: [ { headerText: "Member", key: "entityName", dataType: "string", width: "100px" }, { headerText: "Margin", key: "Margin", dataType: "number", format: "double", width: "120px" }, ], features: [ name: "Paging", type: "remote", pageSize: 10,
recordCountKey: "Data.recordCountKey", }
});
and my controller code returns a nice-formatted Json object :
public dynamic getTrades(string entityName, string level = "member") { // Bind to Service (details omitted) BasicHttpBinding httpBinding = new BasicHttpBinding(); // Converts List type to Json format below JavaScriptSerializer ser = new JavaScriptSerializer(); var tradeData = myService.GetTrades(entityName); var jsonDataObj = Json(new { recordCountKey = 50, responseDataKey = "data", data = tradeData }); string jsonData = ser.Serialize(jsonDataObj); return jsonData; }
Great to hear, thanks Bob.
Angel
Thanks Angel. And yes, we've been already playing with virtualization - and we like it very much.
We just have to be careful that eventually the returned dataset doesn't get into the 10s of thousands...
thank you.
Bob
hey Bob,
Great, thanks. I suggest to try the remote paging first, and if you experience any performance issues, you may try alternatives. One alternative I can think of is to transfer all data to the client, and enable virtualization, so that your UI (the DOM elements) is virtualized. In this way the request may take longer, since you will be serving all data at once, but scrolling through records will be very fast and will happen entirely on the client side, so there won't be any additional server-side requests.
You can have a look at the following samples:
http://ko.infragistics.com/products/jquery/sample/grid/continuous-virtualization
http://ko.infragistics.com/products/jquery/sample/grid/virtualization
Thanks,
thank you kindly, Angel. At this point I will be discussing it with my team.
We had this idea where we would pull say 1k our of 10k records, then pull an additional 1k as needed. i.e. our concern was too many trips to the server if many users are clicking "Next" to page thru the grid..
Not sure how to implement it yet, but I suppose it's possible using the various igGrid events.
regards,
bob
Hey,
just checking if you need any additional help. Thanks