I'm facing very serious problem in custom paging for parent grid as well as sub grids.
Please if possible then provide me sample code in MVC with custom paging(not able to make model for pagesize , pageindex as well)
below is the code which i'm working with:
InvModel
InvId
InvName
Cons -> InvId, ConId, ConName
Funs -> InvId, FunId, FunName
@(Html.Infragistics().Grid<InvModel>() .ID("SearchGrid") .PrimaryKey("InvId") .DataMember("Invs") .Columns(column => { column.For(x => x.InvName).HeaderText("Inv Name").Width("100%");}) .ColumnLayouts(layouts => { layouts.For(x => x.Cons) .PrimaryKey("ConId") .ForeignKey("InvId") .DataMember("Cons") .Columns(column => { column.For(x => x.ConName).HeaderText("Con Name").Width("100%"); }); layouts.For(x => x.Funs) .PrimaryKey("FunId") .ForeignKey("InvId") .DataMember("Funs") .Columns(column => {
column.For(x => x.FunName).HeaderText("Fun Name").Width("100%"); }); }) .DataSourceUrl(Url.Action("InvsList")) .DataBind() .Render() )
Controller Logic
model = select new InvModel() { InvId = c.Field<long>(0), InvName = c.Field<string>(1), Funs = select new FunModel() { FunId = d.Field<long>(0), FunName = d.Field<string>(1), }).AsQueryable(), Cons = select new ConModel() { ConId = f.Field<long>(0), ConName = f.Field<string>(1), }).AsQueryable() }).ToList();return model.AsQueryable()
Problem faced:
1. custom paging model not working. here i'm not providing you so if possible then construct for me it would be great help for me
2. sub grids never follower remote paging. it always work in local. so please give me its code as well. frankly speaking, how it will work i'm not able to understand.
Hello Sanjay,
Thank you for getting back to me.
Please let me know if you need any further assistance with this matter.
Hi Vasya,
Thanks so much for your quick turnaround.
Currently , I've downloaded your solution and trying to fetch my extract from it and once I find something for your help will let you know.
Best Regards.
Hello sanjay,
Thank you for your patience while I was looking into this matter for you.
In your scenario what I can suggest is using the remote paging feature of igHierarchicalGrid. When the ASP.NET MVC wrapper is used it will handle the remote paging for you. You are required to create an action method decorated with GridDataSourceAttribute attribute which returns ActionResult. In the action method just pass the data as an instance of IQueryable. The GridDataSourceActionAttribute class will transform the data according to the request parameters and will return as JsonResult.
Therefore, when remote paging is used, the grid automatically generates the proper request parameters in the following way:
thhp://<server>/grid/PagingGetData?page=28pageSize=25
I made a small sample illustrating how remote paging is implemented in igHierarchicalGrid and I am attaching it for your reference.
Please have a look at the provided sample and let me know if you have any additional questions regarding this matter.
Thank you for posting in our community.
I am currently looking into this matter for you. I will keep you posted on my progress and I will get back to you soon with more information or questions for you.
Please feel free to continue sending updates to this case at any time.