I use Radzen datagrid control with paging and I find two issues:
1 issue is when we are on first page and click on previous page always make a request although the buttons look like disabled.
2 issue is when I am adding a new row to my repo and call the function GoToPage(lastPage) to see the new row in the end of the grid.
//here is the code how I calculate my last page
var recordCount = drawScheduleCount + 1;
var lastPage = (int)Math.Ceiling((double)recordCount / (double)Constants.Grid_Page_Size);
rg.GoToPage(lastPage - 1);
Your function lastPage() doesn't work correctly as well when we have only one row to show on this last page.
The grid loads the correct data but marks (wrong) the previous page number only when there is one row on the last page. If we have more then one row on last page everything is Ok.
Thanks @Vesko_I! We will do our best to fix these in the next update. I'm unable to reproduce the second issue on our demo where the last page is with only one record:
I am using an Odata service to manage my data.
The scenario is: first I am adding a new row through OData service to the table and after than I am calling rg.LastPage() which make a new request to the OData service and get the data.
When I am using rg.LastPage() I am seeing the previous page which the previous data. So I calculate the last page by myself with the code in my fist post and it works better but the page pointer is on the previous page.
May the issue is happening when someone modified the data before calling LastPage().
I hope this info help you to reproduce the issue.
Make sure you've update total records count variable bound Count property of the DataGrid.
Here is the code of loading data to the datagrid.
private async Task LoadDrawScheduleData(LoadDataArgs args)
filterDrawSchedule = args.Filter;
orderByDrawSchedule = args.OrderBy;
var result = await drawScheduleService.GetDataAsync(filterDrawSchedule, args.Top, args.Skip, args.OrderBy, count: true);
drawSchedules = result.Value.AsODataEnumerable();
drawScheduleCount = result.Count;
Variable drawScheduleCount is my total records count variable and it is updated when the response of lastPage comes. I tried to increased it before calling LastPage but the result is the same - I see again the previous page.
I tested LastPage() method with your last version and it hasn't worked yet.