Hello.
I am using remote paging in my iggrid, but I cannot get the paging to work.
I have about 700 rows in my backend data but I am querying them and displaying them in the iggrid 10 rows at a time. My problem is that it would display the 10 items but I dont have a way to move to the next page to see the next 10 items and so on because i can only see page 1 and the button/dropdown for pages do not have page 2,3,4 etc.
Here's the snippet I'm using:
features.Paging().PageSize(10).Type(OpType.Remote).PageSizeUrlKey("pageSize").PageIndexUrlKey("pageIndex").TotalRecordsCount(100);
Hi Jessica,
PageSizeUrlKey, PageIndexUrlKey and TotalRecordsCount are not needed if you're using Grid MVC Wrapper to do the paging for you (they are used when you're implementing custom paging). Are you implementing paging yourself?
If you're not implementing paging yourself then in order for remote paging to work you need to set DataSourceUrl to point to an action method decorated with GridDataSourceAction attribute. Check out this sample which demonstrates remote paging: http://ko.infragistics.com/products/jquery/sample/grid/paging-api
What is your backend data? Is it IQueryable or DataSet or DataTable? All of the tree support paging, but note that you should pass the whole data (do not try to extract only the records needed for one page. This is done by the Grid MVC wrapper internally).
It will be good if you post more of your grid chaining configuration and also controller action methods involved in grid data binding.
Hope this helps,
Martin Pavlov
Infragistics, Inc.
I'm guessing the problem is that it does not know that I have 700 rows in my backend data because I am only giving it 10 rows at a time.
Yes. The problem comes form the fact that you're passing only 10 records back to the grid and the grid thinks that these are all the records in the data source.
The best way to overcome this is to use Entity Framework model or LINQ to SQL model.
If the database you're using is not supporting Entity Framework or LINQ to SQL Model then you should go with the custom solution.
One custom solution is to use GridModel class to configure the grid in the controller. You should also inherit GridPaging class and override the TransformDataSource method. You also need a new property to tell the paging what is the total records count in the data source. Last, you should instantiate your custom paging class when configuring the paging.
Here is an example code:
public class CustomGridPaging : GridPaging
{
public int CustomTotalRecordsCount { get; set; }
public override void TransformDataSource(NameValueCollection queryString, IGridModel grid, out IQueryable queryable)
queryable = (IQueryable)grid.DataSource;
this.TotalRecordsCount = this.CustomTotalRecordsCount;
}
And the usage is:
GridModel gridModel = new GridModel();
gridModel.Features.Add(new CustomGridPaging()
Type = OpType.Remote,
PageSize = 5
,
CustomTotalRecordsCount = 2390
});
Hi Martin i see that in Infragistics.web.aspnetcore the customtotalrecordscount variable cannot be set from the transformdatasource function.
How do i implement the same in .net core?
I'd like to see an example of how to implement remote paging without the IG wrappers. Is it too complicated ?
thanks.
Bob
Attached you can find a complete example.
Best regards,Martin PavlovInfragistics, Inc.
Can you give me a complete working example? I do not see how CustomTotalRecordsCount is mapped to the paging of the grid.
How do I use this in my view?