I'm having a problem with remote paging. It is not reading my reply properly and throwing a parse error. Here is my grid definition:
$("#igGrid").igGrid({ dataSource: "/SrvGrid?action=getList", columns: [ { headerText: "ID", key: "dataId", }, { headerText: "Data", key: "data", } ], features: [{ name: 'Paging', type: "remote", pageSize: 2, responseDataKey : "records", recordCountKey : "totalRecordCount", pageSizeUrlKey : 'pageSize', pageIndexUrlKey : 'pageIndex' } ] });
I am getting the proper reqest parms sent to my servlet :
http://localhost:8080/SrvGrid?action=getList&pageIndex=0&pageSize=2&_=1416188204654
My servlet queries the DB to create a list and then I build a Wrapper class around it (I don't know if this is correct or if theres an easier way) :
class Wrapper { public int totalRecordCount; public List<Data> records; }
The return JSon string looks like this :
{"totalRecordCount":5,"records":[{"dataId":1,"data":"AAA"},{"dataId":2,"data":"BBB"}]}
and it looks/parses fine in Firebug - an object with 2 elements, the 'totalRecordCount' and 'records', exactly as specified in the Paging feature of the grid. However, it returns this error:
Error: The remote request to fetch data has failed: (parsererror) There was an error parsing the JSON data and applying the defined data schema: The input data doesn't match the schema, the following field couldn't be mapped: dataId
I have no idea why this is not working. I thought the grid would stripoff the wrapper and and use just the 'records' property to populate the grid.
Strangely enough, if the servlet just passes back my data in the Json 'list' (WITHOUT the Wrapper), it is parsed correctly and the grid is loaded. So it seems to recognize that its remote paging when SENDING the request (by adding the paging parms) but it doesnt recognize that its using remote paging when RECEIVING the result - it doesnt know what to do with the 'totalRecordCount' and 'records' properties.
Can you help?
Thanks.
Hi Eveyone,
Could anyone suggest solution for the above?
Warm regards,
Saravanan
Hi,
Can anyone lookup and suggest me how to pass pageSizeUrlKey and pageIndexUrlKey in angular for remote binding
Thanks,
I am having an issue with igGrid with Angular for Remote binding.
I cant able to get data for pageSizeUrlKey,pageIndexUrlKey to pass in "dataSourceUrl"
The below code i've using for Remote Binding
HTML Page:
<ig-grid #myIgGrid1 [(options)]="IgGridOptionsMain" [(dataSource)]='igdata' auto-generate-columns="false" widgetId='grid1'> </ig-grid>
ts File:import { IgniteUIModule, IgGridComponent, IgGridPagingFeature } from "igniteui-angular2";
@ViewChild("myIgGrid1") myGrid3: IgGridPaging;
var CurrentPage = $("#grid1").igGridPaging("option", "pageIndexUrlKey");//This method of getting key not working
this.pageIndex = this.myGrid2.pageIndexUrlKey; //By call from control id is return undefined only
this.IgGridOptionsMain = { //autoCommit: true, dataSource: this.igdata, dataSourceUrl: "http://localhost:61021/Home/GetDynamicUserList" + "?ParamData=" + encodeURIComponent(JSON.stringify(this.ObjParamArray)), requestType: "GET", responseContentType: "application/json; charset=utf-8", jsonpRequest: true, responseDataKey: "Records", primaryKey: "sNo",
columns: [ { key: "sNo", headerText: "UserId", dataType: "number", hidden: true, },
/*********/
],
], features: [ { name: "Paging", type: "remote", recordCountKey: "RecordCountKey", pageSizeUrlKey: "PageSize", pageIndexUrlKey: "CurrentPage", pageSize: 10, },
}
Please guide me to get pageSizeUrlKey and pageIndexUrlKey from iggrid to pass it for Controller call for Remote binding
G.Saravanan
Hello C J,
Please let me know if you need any further assistance with this matter.
Hello Adil,
I am glad that you have been able to resolve this issue.
Please feel free to contact us and create either a support request on our web site or a new forum thread in case that you have any questions.
Thank you for choosing Infragistics components.