Closed absinghal closed 1 year ago
Hello @hanastasov
Any ETA for this issue ?
Thanks
Hi @dkamburov
To see this live in action, pl visit http://freeten.livmatter.com/app/index?publisher=FreeTen&Product=AdventureDemo&Audience=Public&appcode=advdem
and select orders from sale menu
Grid shows only 1-100 of 100 records, where as there are total 119 records, because the TotalRecordsCount property is not working. We are using server side binding to a dataset.
Hi @dkamburov
To see this live in action, pl visit http://freeten.livmatter.com/app/index?publisher=FreeTen&Product=AdventureDemo&Audience=Public&appcode=advdem
and select orders from sale menu
Grid shows only 1-100 of 100 records, where as there are total 119 records, because the TotalRecordsCount property is not working. We are using server side binding to a dataset.
Are you sure this is the issue? It seems to me that your data returns only 16 records at all:
As suggested in previous post, pl click on Sale Menu > Orders Menu item. Here is a screenshot:
For checking the json payload returned by the Sale>Orders menu item, you may check in the browser dev tools network tab.
Here it is attached for easy reference. As you can see server returns "TotalRecordsCount":100 --> found no means to set this value on server side
@absinghal In general binding to a data set has some limitations as described in the documentation: https://www.igniteui.com/help/ighierarchicalgrid-binding-to-dataset#binding
However paging is one of the supported remote scenarios. We also have a sample that demonstrates it here: https://www.igniteui.com/hierarchical-grid/dataset-binding And with that setup the total number of records in the table gets populated in TotalRecordsCount and the records for the current page get populated in Records.
Not sure why you would need an additional property for this scenario. Does the total records count differ than the actual number of records in your table? For example does your data base returns only a small part of the data in your data table so your data table does not hold the full data when you bind it to the grid?
@MayaKirova yes in our case, we have the data base return only a small part of the data in our data table so that our data table does not hold the full data when we bind it to the grid. This is because full data may be very large.
In IgniteUI for Asp .net MVC we used to implement a CustomGridPaging class as follows
Class CustomGridPaging
Inherits GridPaging
Public Property TotalRecordsCount As Integer
Public Overrides Sub TransformDataSource(ByVal queryString As NameValueCollection, ByVal grid As IGridModel, <Out> ByRef queryable As IQueryable)
MyBase.TransformDataSource(queryString, grid, queryable)
Me.Store("totalRecordsCount") = Me.TotalRecordsCount
End Sub
End Class
And use as follows (PageCount and TotalCount are local variables)
myGrid.Features.Add(New CustomGridPaging() With {.Type = OpType.Remote, .Inherit = True,
.PageSize =PageCount, .TotalRecordsCount = TotalCount,
.PageSizeList = New List(Of Integer)({100, 500, 1000})})
But above method does not work in asp .net core version
@MayaKirova tested above again in asp .net core and found issue with something else in our code base. Lots of things changed during our upgrade to asp .net core, and this issue wrongly got attributed to Ignite UI asp .net core version.
So if you are fine with above method, we are good to go and can close this issue.
Thanks for having a look at this.
@absinghal Thanks for letting me know. In general we have made this property TotalRecordsCount internal a while ago (around version 16.1) since we consider it something internal for our paging implementation. You can use your own custom paging if you'd like and overwrite the response methods, for example:
public class CustomPaging : GridPaging
{
public int MyTotalCount { get; set; }
public override void TransformDataSource(IQueryCollection queryString, IGridModel grid, out IQueryable queryable)
{
base.TransformDataSource(queryString, grid, out queryable);
// set your custom count
this.MyTotalCount = 100;
}
public override void HandleResponse(LargeJsonResult result)
{
WrappedGridResponse response = result.Value as WrappedGridResponse;
response.TotalRecordsCount = this.MyTotalCount;
}
public override void HandleResponse(WrappedGridResponse response)
{
response.TotalRecordsCount = this.MyTotalCount;
}
}
Just note that some features like the [GridDataSourceAction] attribute will not work out of the box with the custom paging. You will have to use the GridModel where you added the custom paging feature to get the data for any remote endpoints.
Hope this helps.
Is your feature request related to a problem? Please describe.
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://www.infragistics.com/community/forums/f/ignite-ui-for-jquery/74927/server-side-paging/379131#379131
Now this member is not found.
Describe the solution you'd like
should be added back to be able to specify TotalRecordsCount in the initial load of the grid with gridpaging enabled.
Describe alternatives you've considered
Grid is bound to dataset on the server side at the time of initial load. The columns and structure are not known ahead of time, so conversion to a typed model is not possible.
Additional context
https://www.infragistics.com/community/forums/f/ignite-ui-for-asp-net-core/124170/totalrecordscount/544482?focus=true#544482,