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; }
I could not get recordkeycount and responseDataKey properties in intellisense also. What should I need to do to get those properties?
Hi Angel,
I was previously using Paging type as local. But my page takes more time to retrieve all the data from DB. So I thought of trying "remote" type.
cshtml page
var PageSize = @Html.Raw(Json.Encode(ViewBag.PageSize)); var MonthofQtr = @Html.Raw(Json.Encode(ViewBag.MonthofQtr));
{
name: "Paging", type: "remote", pageSize: DefaultPageSize, inherit: true, nextPageLabelText: "Next", prevPageLabelText: "Previous", pageSizeDropDownLocation: "inpager", pageSizeList: PageSize, },
controller.cs
public JsonResult inputmethod() { var result = new JsonResult(); IEnumerable <inputmodel> cuivm = new List<inputmodel>();
try { cuivm = InputRepository.inputmethod(GetUserName());
result.Data = Json(new { isRedirect = false, Records = cuivm.AsQueryable(),PageSize = Constants.PageSizes(), //Number of records to be displayed in a page 100,200, 400, 600, 800, 1000 DefaultPageSize = Constants.DefaultPageSize(), //Displays top n number of records by default. 100,200... TotalRecordsCount = cuivm.Count(), //total number of records retrieved from DB. (recordCountKey) });
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; result.MaxJsonLength = int.MaxValue; } catch (Exception ex) { } return result; }
Could you please help me to retrieve the recordkeycount from this IEnumerable list? How should I retrieve responseDataKey in my code?
I have given my defaultpagesize and pagesize in web.config file
web.config
<!-- Grid Paging values for rows-->
<add key="DefaultPageSize" value="100" /> <add key="GridPageSize" value="50, 100, 200, 400, 600, 800, 1000" />
Hello,
In my opinion your scenario is related to https://github.com/IgniteUI/igniteui-angular2/issues/146
Follow the issue to receive notification, we will resolve it soon and your scenario should be covered too.
We are following the same above steps to use remote paging in Ig tree grid. below are our codesnippet, we are getting error like arrays and iterates are only allowed when we give URl in dataSource. Please help us on this.
<ig-tree-grid [options]='gridOptions' [widgetId]='id'></ig-tree-grid>
this.gridOptions = { responseDataKey: "Data.Records", dataSource: "/api/DealsList?UserID=" + this.userID, height: "500", width: "100%", columns: [ ---------- ], features: [ { name: "Paging", type: "remote", pageSize: 20, recordCountKey: "Data.recordCountKey", pageIndexUrlKey: "pageIndex", pageSizeUrlKey: "pageSize" } ] };
Json I'm getting from API:
{"ContentEncoding":null,"ContentType":null,"Data":{"Records":"[{\"DealId\":47r3254545456,\"Phase\":541,\"DealName\":\"StatusChangeTest\",\"StatusId\":22457,\"StatusName\":\"Re-Authorization Approval Pending\"}]","recordCountKey":3634,"responseDataKey":"Records"},"JsonRequestBehavior":0,"MaxJsonLength":null,"RecursionLimit":null}
error while i'm running :
ERROR Error: Error trying to diff '/api/DealsList?UserID=X202942'. Only arrays and iterables are allowed
ERROR CONTEXT [object Object]
Do we missing some thing on this setting for remote paging.
Hi Alexander.
I would like to know about if with remote paging can I still using this kind of filters on the grid.
Currently, before team developer than mine, were sending all data to the client and doing paging, sorting and filtering all sucessfully but when end workdays at office, IIS (Internet Information) died because there were so much clients connected and getting around 3 thousands register in this way.
I am planning change for remote paging, but I am wondering about these filters since they are so useful for our users.
Thanks in advance. Here in the company we got IG licensed btw.