Hi,
I have a custom filter which is applied on LoadData. The DataGrid is in pagination mode with 5 items per page. Say I am on page 3, then I apply my custom filter and call grid.Reload(). Then, say, because of the filtering there is now only 1 row but the grid still thinks it's on page 3 and passes me the Skip for page 3. I added some logic to skip to the last page of data if the Skip passed in is beyond that. This works fine but the pager still thinks its on page 3 instead of the last page of the new filtered dataset. Can the grid actually calculate the new skip by itself? Can the pager recognize the new page? I think it would be great if I could pass the new skip back to the LoadData caller via the args.
So the question is how to properly update the page number after filtering if filtering changes the number of pages? Thanks!
Here's my logic for new skip:
var count = query.Count();
var pageSkip = args.Skip.Value / args.Top.Value;
var pageMax = count / args.Top.Value;
args.Skip = Math.Min(pageSkip, pageMax) * args.Top.Value;