This question is locked. New answers and comments are not allowed.
I am trying to set up paging in my grid so that when a user navigates to a page only the data for that specific page is retrieved from the database and pushed down to the client. Here is some sample code to give you an idea.
The JSON sent down to the client is this...
So obviously the correct JSON is getting serialized but for some reason the Total value is not getting serialized as it was set.
I have attached a solution demonstrating the issue. There should be more than 1 page.
[GridAction]
public
ActionResult GetGridData()
{
var list =
new
List<UserViewModel>();
for
(
int
i = 0; i < 100; i++)
{
list.Add(
new
UserViewModel { Id = i});
}
var pagingList = list.Skip(20).Take(5).ToList();
return
View(
new
GridModel { Data = pagingList, Total = list.Count});
}
The JSON sent down to the client is this...
{"data":[{"Id":24},{"Id":23},{"Id":22},{"Id":21},{"Id":20}],"total":5}
So obviously the correct JSON is getting serialized but for some reason the Total value is not getting serialized as it was set.
I have attached a solution demonstrating the issue. There should be more than 1 page.