IgGrid seem not support paging in angular context. I have a angular service to load data by paging. I will call method in this service to bind data to igGrid.
I've setup grid enable paging features:
$scope.gridOptions = { dataSource: dataSource, width: "100%", height: "400px", primaryKey: "id", autoCommit: true, autoGenerateColumns: false, autoAdjustHeight: true, columns: columnsTranslated, features: [{ name: "Paging", type: "local", pageSize: pageSize, showPageSizeDropDown: false }] }
And dataSource= angularService.getData(pageindex,pageSize);
But I don't know how I can specify total number of record/total for this case.
I don't want grid bind directly to data source by an URL because I want to pre-process data in angularService before it is received on client.
Hello,
Your dataSource should have a property field (if it doesn't already has such) which contains information about the total records count and this property should be passed to igGridPaging with the recordCountKey option.
As understand datasource = angularService.getData(pageindex,pageSize); must return an arrays with field to bind into grid
Eg:
datasource = [{id: 1, name: "acb"},{id: 2, name: "acb2"},{id: 3, name: "acb3"}]
If I set recordCountKey: "totalCount", how I put totalCount value in datasource?
You need to specify the type of the data source and response data key:
I modified your sample a bit:
http://jsfiddle.net/qfabkd58/7/
It not work as expected.
I upload my sample code to here:
http://jsfiddle.net/quyetvv/qfabkd58/
When run this, I can see my dataSource and totalCount is correct as I expected but it is not working.
Here is error log:
http://screencast.com/t/awHuhhEZDE
Could you please help send me a working example from this code?
Thank you so much!
You can have
datasource = [{records:{id: 1, name: "acb"},{id: 2, name: "acb2"},{id: 3, name: "acb3"}, totalCount: 3}]
And please note that you may also need to specify the responseDataKey option to be "records".