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://es.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,
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.
Regards, Monika Kirkova, Infragistics
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.
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
I am binding to a Dataset -- how to do in that case ?
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.
5531.igGridTotalRecordsCount.zip
Hi Monika
Actually conversion to model is not possible, because the dataset fields are not known ahead of time.
As per my understanding, igGrid converts dataset to list(of object) models internally.
So is it possible to convert dataset to a model with list(of object) and the TotalRecordsCount field?
Note that dataset may have multiple tables in our case (we are usingigHierarchicalGrid)
The totalRecordsCount of the dataSource could be set as follows:
function dataBinding(evt, ui) {
if (ui.owner.options.dataSource.settings) {
ui.owner.options.dataSource.settings.dataSource.TotalRecordsCount = 20;
As stated above please keep in mind that by setting the totalRecordsCount, new pages are created and displayed in order to match the number set through the property, however, the additional pages are empty.
Option 2 "totalRecordsCount of the dataSource could be set in the client side" --> Pl provide example.
Feature request for option 1 added here
github.com/.../2189
The conversion of the dataset to model is achieved internally and could not be modified and responseDataKey could not be set in the controller. As stated in my previous response the totalRecordsCount of the dataSource could be set in the client side, however, loading the data should be handled manually when the Page Index is changed.
What I can suggest is creating a feature request regarding exposing totalRecordCount property of the Paging feature in our GitHub repository here if you want to see it implemented in any of our future releases. This will give you the opportunity to communicate directly with our developers and get notifications when new information regarding your query is available.
When creating the request please be sure to be specific and provide as much details as possible. Attaching a working sample, screenshots and any information that consider relevant are going to be very helpful.
Please let me know if you need more information.