Hello
Converted igGrid from Asp .net MVC to Asp .net Core.
Earlier there used to be a TotalRecordsCount member in the GridPaging feature.
Mentioned here https://ko.infragistics.com/community/forums/f/ignite-ui-for-jquery/74927/server-side-paging/379131#379131
Now this member is not found
How to specify TotalRecordsCount in the initial load of the grid with gridpaging enabled.
Need asap
Thanks
Hello Abhishek,
Your requirement could be achieved in two different ways.
The first option is to convert the DataTable from the DataSet to a Model(defined in the Products.cs file) and pass a Json to the View, containing the Model and the TotalRecordsCount. This should be done, in order for the Grid to bind correctly to the data and for the Paging to be able to access TotalRecordsCount field and to set it as responseDataKey.
Another possibility is to use the totalRecordsCount method of the dataSource in a method bound to the databinding event of the Grid. By setting the totalRecordsCount, new pages are created and displayed in order to match the number set through the method, however, the additional pages are empty.
Below I am attaching a sample demonstrating the first approach. Please test it on your side and let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics
5531.igGridTotalRecordsCount.zip
I am binding to a Dataset -- how to do in that case ?
In Asp.Net MVC this could be achieved the same way. The data model should have a filed for the TotalRecordsCount and the property recordCountKey could be set to the TotalRecordsCount. This could be achieved as follows:
@((Html.Infragistics().Grid<igGridTotalRecordsCount.Models.Products>().ID("grid1")
.Features(features =>
{
features.Paging().PageSize(2).RecordCountKey("TotalRecordsCount");
})
.ResponseDataKey("Records")
.DataSourceUrl(Url.Action("GridGetData"))
.DataBind()
.Render()))
Below I am attaching a sample demonstrating the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
igGridTotalRecordsCount.zip
Can you show how to achieve this in Asp .Net Core MVC wrapper ?
An earlier solution from IG support for Asp .Net MVC classic suggested to use CustomGridPaging - but even that is not working in .net core version.
After investigating this further, I have determined that the property recordCountKey could be set in order to specify the total number of records in the data source. However, the data should have an extra property which holds the real row count and recordCountKey should be set to this property. This could be achieved as follows:
"shippings": [{"ShipName": "Vins et alcools Chevalier", "ShipAddress" : "59 rue de lu0027Abbaye",
"ShipCity" : "Reims"},
{"ShipName": "Vins et alcools Chevalier", "ShipAddress" : "59 rue de lu0027Abbaye", "ShipCity" : "Reims"}
], "TotalRecordsCount": 20
}
$("#grid").igGrid({
. . .
features: [ {
name: "Paging",
recordCountKey: "TotalRecordsCount"
}]
});
Please test it on your side and let me know if you need any further information regarding this matter.