Create a DataGrid with paging and set PageSize =2, PageNumbersCount = 2
Then, sort grid by "Value" Property.
While paging, the grid displays duplicate NAME values and does not display some entries at all.
In this example, the first page displaying Name2, Name1; second page Name4, Name1(!); third page
Name5,8; next Name 9,10 and finally page Name 6,7
WHERE Name3????
Many thanks for reply!
But on local collection this works normally, right.
Try to do this with database table.
The problem is that a sql query of this type is being generated:
SELECT s. "Id", s. "Name", s. "Value"
FROM public. "Students" AS s
ORDER BY s. "Value"
LIMIT 2 OFFSET 2
which returns data for the second page, skipping record number 3, instead of it shows record number 1
Fantastic..same sql query to different db providers and:
Postgresql returns unexpected results, even by manual query in pgadmin;
MySql works fine...
The problem can be solved by including the id column in the sorting condition. tell me how you can do this?
Solution to the problem:
If you intend to sort data with rolling values, you should only use data loading via the LoadData event and override the method:
if (!string.IsNullOrEmpty(query.OrderBy)) items = items.OrderBy(query.OrderBy).ThenBy(x => x.Id);
You must add another sorting condition by some unique field.
Otherwise, any server will return unexpected results.