I'm reading about igGrid remote paging here : http://help.infragistics.com/NetAdvantage/jQuery/2013.1/CLR4.0?page=igGrid_Paging.html.
As per the link above, it says :
"If you are implementing your own remote service (for example in ASP.NET or PHP), in order to properly initialize and render the pager, your service must specify both the responseDataKey (grid option) and the recordCountKey (paging option). The recordCountKey member tells the Paging widget how many records in total are in the backend. The responseDataKey specifies which property in the response contains the resulting data.
I am returning my data in responseDataKey and recordCountKey but it is not working for me. I have tried by removing [GridDataSourceAction] attribute from my Action.
Below is my code :
CSHTML :
@( Html.Infragistics().Grid<Searchclient>() .ID("igGrid1") .Width("auto") .EnableHoverStyles(false)
// Enable continuous virtualization .PrimaryKey("PartyId1")
.Columns(column => { column.For(x => x.FullName).DataType("string").HeaderText("Full Name").Template("<div style='min-width:100px'>${FullName}</div> ");
//column.For(x => x.TelPremise).DataType("string").HeaderText("Tel Premise").Template("<div style='min-width:100px'>${TelPremise}</div> ");
//column.For(x => x.TelCell).DataType("string").HeaderText("Tel Cell").Template("<div style='min-width:100px'>${TelCell}</div> ");
column.For(x => x.CompanyName).DataType("string").HeaderText("Company Name").Template("<div style='min-width:150px'>${CompanyName}</div> ").Hidden(true); column.For(x => x.FirstName1).DataType("string").HeaderText("FirstName1").Template("<div style='min-width:130px'>${FirstName1}</div> ").Hidden(true); column.For(x => x.LastName1).DataType("string").HeaderText("Last Name1").Template("<div style='min-width:130px'>${LastName1}</div> ").Hidden(true); column.For(x => x.Firstname2).DataType("string").HeaderText("First Name2").Hidden(true); column.For(x => x.Lastname2).DataType("string").HeaderText("Last Name2").Hidden(true); column.For(x => x.StreetNo).DataType("string").HeaderText("Street No").Template("<div style='min-width:100px'>${StreetNo}</div> ").Hidden(true); column.For(x => x.Street).DataType("string").HeaderText("Street").Template("<div style='min-width:100px'>${Street}</div> ").Hidden(true); column.For(x => x.Address).DataType("string").HeaderText("Address").Template("<div style='min-width:100px'>${Address}</div> "); column.For(x => x.City).DataType("string").HeaderText("City").Template("<div style='min-width:80px'>${City}</div> "); column.For(x => x.State).DataType("string").HeaderText("State").Template("<div style='min-width:80px'>${State}</div> "); column.For(x => x.Zipcode).DataType("string").HeaderText("Zipcode").Template("<div style='min-width:100px'>${Zipcode}</div> "); column.For(x => x.CustomerNumber).DataType("string").HeaderText("Customer Number").Hidden(true); column.For(x => x.AccountNumber).DataType("string").HeaderText("Account Number").Template("<div style='min-width:120px'>${AccountNumber}</div> "); column.For(x => x.Email1).DataType("string").HeaderText("Email1").Template("<div style='min-width:100px'>${Email1}</div> "); column.For(x => x.Email2).DataType("string").HeaderText("Email2").Template("<div style='min-width:100px'>${Email2}</div> "); column.For(x => x.Email3).DataType("string").HeaderText("Email3").Hidden(true); column.For(x => x.Email4).DataType("string").HeaderText("Email4").Hidden(true); //column.For(x => x.PartyId).DataType("string").HeaderText("PartyId"); column.For(x => x.PartyId1).HeaderText("PartyId").DataType("int").Hidden(true);
}) .Features(features => {
features.Responsive().ForceResponsiveGridWidth(false).EnableVerticalRendering(false).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("FullName").Classes("ui-visible-phone ui-visible-tablet ui-visible-desktop").Configuration(conf => conf.AddColumnModeConfiguration("phone", c => c.Template("<span>${FullName}</span>")));
setting.ColumnSetting().ColumnKey("telpremise").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("firstname1").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("telcell").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("street").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("address").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("lastname1").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("email1").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("address").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("zipcode").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("accountnumber").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("email2").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("city").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("state").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("PartyId1").Classes("ui-hidden-phone");
});
features.Hiding().HiddenColumnIndicatorHeaderWidth(14).ColumnSettings(s => s.ColumnSetting().ColumnKey("CompanyName").AllowHiding(true)); features.Resizing().AllowDoubleClickToResize(true).DeferredResizing(true); features.Paging().Type(OpType.Remote).PageSize(10).PrevPageLabelText("Prev").NextPageLabelText("Next"); features.Sorting().Type(OpType.Local).Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("PartyId").AllowSorting(true);
}); features.RowSelectors().EnableCheckBoxes(true).EnableRowNumbering(false); features.Selection().MouseDragSelect(false).MultipleSelection(false).Mode(SelectionMode.Row); features.Filtering().Mode(FilterMode.Simple); features.Sorting().Type(OpType.Remote); }) .DataSourceUrl(Url.Action("GetAccountList")) .Width("auto")
.DataBind() .Render() )
CS :
// [GridDataSourceAction] public ActionResult GetAccountList(int page, int pageSize) { if (Session["Condition"] != null) { string condition = (string)Session["Condition"]; var searchlist = DBmain.GetSearchClientPaging(condition, page, pageSize); return Json(new { responseDataKey = searchlist, recordCountKey = 295207 }, JsonRequestBehavior.AllowGet);
} }
Please help. Let me know if you have any question.
Hello Atul,
Thank you for posting in our forum.
The ‘responseDataKey’ option tells the igGrid which property in the server response would contain the data that would be used when databinding. It should be present in the grid initialization configuration – here is just an example:
@(Html.Infragistics() .Grid(Model) .ID("grid") .Width("100%") .Height("600px") .PrimaryKey("ProductID") .AutoGenerateColumns(false) .AutoCommit(true) .Columns(column => { column.For(x => x.ProductID).HeaderText("Id").Width("20%"); column.For(x => x.ProductName).HeaderText("Name").Width("50%"); column.For(x => x.StartDate).HeaderText("Date").DataType("date").Width("30%"); }) .Features(features => { features.Paging().PageSize(10).Type(OpType.Remote).RecordCountKey("TotalRecordsCount"); }) .DataSourceUrl(Url.Action("GetData1")) .ResponseDataKey("Records") .Render() )
The [GridDataSourceAction] attribute allows you to use the remote grid features out-of-the-box. Removing it would mean you would have to implement all the data handling server logic yourself, so unless you have some specific requirement, I would suggest that you do not remove it, and use the default implementation (if it suits your scenario, of course).
I have attached an isolated MVC code sample you may find helpful: it has a grid with remote features and uses [GridDataSourceAction] in the Controller. I have used Ignite UI 18.2 – you may want to change the dll files and CDN links in case it differs from the version you use in your own application.
igGridRemoteFeatures.zip
In case adding ‘responseDataKey’ to your grid configuration and [GridDataSourceAction] to your Controller does not solve your problem, I would appreciate some additional information regarding your scenario:
I look forward to your reply.
Thanks Vasil , it is working now but i am also displaying child grid which is not rendering now. You can check in above code that i am displaying child grid.
I am returning below JSON from server :
{ "Records": [ { "TelPremise": "800-722-1695 ", "TelCell": " ", "CompanyName": "SAC - Security Alliance Center", "FirstName1": "David", "LastName1": "Koutek", "Firstname2": "Debra", "Lastname2": "Koutek", "StreetNo": "180", "Street": "River Oaks", "Address": "180 River Oaks Cir", "City": "Sanford", "State": "FL", "Zipcode": "32771-9319", "CustomerNumber": "", "AccountNumber": "", "Email1": "", "Email2": "", "Email3": "", "Email4": "", "PartyId": "1411", "PartyCompany": "0", "PartyId1": 1411, "FullName": "SAC - Security Alliance Center / David and Debra Koutek", "partyphonenumber": [ { "ID": 0, "PartyID": 0, "TypeID": 2, "PhoneNumber": "407-324-7477", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 1 Work or Home", "Template": "rowCriticalred" }, { "ID": 0, "PartyID": 0, "TypeID": 4, "PhoneNumber": "", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 1 Cell", "Template": "rowCriticalvoilet" }, { "ID": 0, "PartyID": 0, "TypeID": 6, "PhoneNumber": "407-268-4862", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Fax Numbers", "Template": "rowCriticalyellow" }, { "ID": 0, "PartyID": 0, "TypeID": 1, "PhoneNumber": "800-722-1695", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Premise Numbers", "Template": "rowCriticalblue" }, { "ID": 0, "PartyID": 0, "TypeID": 2, "PhoneNumber": "407-830-8009", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 1 Work or Home", "Template": "rowCriticalred" }, { "ID": 0, "PartyID": 0, "TypeID": 7, "PhoneNumber": "407-965-0771", "DNC": false, "Comment": "SAC VoIP", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Other Numbers", "Template": "rowCriticalblack" }, { "ID": 0, "PartyID": 0, "TypeID": 7, "PhoneNumber": "407-688-7003", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Other Numbers", "Template": "rowCriticalblack" }, { "ID": 0, "PartyID": 0, "TypeID": 7, "PhoneNumber": "407-688-7002", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Other Numbers", "Template": "rowCriticalblack" }, { "ID": 0, "PartyID": 0, "TypeID": 7, "PhoneNumber": "407-688-7001", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Other Numbers", "Template": "rowCriticalblack" }, { "ID": 0, "PartyID": 0, "TypeID": 3, "PhoneNumber": "", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 2 Work or Home", "Template": "rowCriticalgreen2" }, { "ID": 0, "PartyID": 0, "TypeID": 5, "PhoneNumber": "", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 2 Cell", "Template": "rowCriticaldarkyellow" } ] }, { "TelPremise": "407-555-2121", "TelCell": "407-555-2124", "CompanyName": "Advance SAC", "FirstName1": "Carol", "LastName1": "Delete 111", "Firstname2": "Debbie", "Lastname2": "Koutek", "StreetNo": "123", "Street": "Main", "Address": "123 Main St", "City": "Sanford", "State": "FL", "Zipcode": "32771", "CustomerNumber": "", "AccountNumber": "", "Email1": "", "Email2": "debbie@sacmonitoring.com", "Email3": "", "Email4": "", "PartyId": "301327", "PartyCompany": "0", "PartyId1": 301327, "FullName": "Advance SAC / Carol Delete 111 or Debbie Koutek", "partyphonenumber": [ { "ID": 0, "PartyID": 0, "TypeID": 2, "PhoneNumber": "407-555-2122", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 1 Work or Home", "Template": "rowCriticalred" }, { "ID": 0, "PartyID": 0, "TypeID": 5, "PhoneNumber": "407-555-2125", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 2 Cell", "Template": "rowCriticaldarkyellow" }, { "ID": 0, "PartyID": 0, "TypeID": 1, "PhoneNumber": "407-555-2121", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Premise Numbers", "Template": "rowCriticalblue" }, { "ID": 0, "PartyID": 0, "TypeID": 4, "PhoneNumber": "407-555-2124", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 1 Cell", "Template": "rowCriticalvoilet" }, { "ID": 0, "PartyID": 0, "TypeID": 3, "PhoneNumber": "407-555-2123", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "User 2 Work or Home", "Template": "rowCriticalgreen2" }, { "ID": 0, "PartyID": 0, "TypeID": 6, "PhoneNumber": "", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Fax Numbers", "Template": "rowCriticalyellow" }, { "ID": 0, "PartyID": 0, "TypeID": 7, "PhoneNumber": "", "DNC": false, "Comment": "", "DateCheck": "/Date(-62135575200000)/", "DateUnCheck": "/Date(-62135575200000)/", "DNCChangeBy": null, "SortOrder": 0, "TypeName": "Other Numbers", "Template": "rowCriticalblack" } ] } ], "TotalRecordsCount": 2 }
my CSHTML code is :
@( Html.Infragistics().Grid<Searchclient>() .ID("igGrid1") .Width("auto") .EnableHoverStyles(false) // Enable continuous virtualization .PrimaryKey("PartyId1") .Columns(column => { column.For(x => x.FullName).DataType("string").HeaderText("Full Name").Template("<div style='min-width:100px'>${FullName}</div> "); //column.For(x => x.TelPremise).DataType("string").HeaderText("Tel Premise").Template("<div style='min-width:100px'>${TelPremise}</div> "); //column.For(x => x.TelCell).DataType("string").HeaderText("Tel Cell").Template("<div style='min-width:100px'>${TelCell}</div> "); column.For(x => x.CompanyName).DataType("string").HeaderText("Company Name").Template("<div style='min-width:150px'>${CompanyName}</div> ").Hidden(true); column.For(x => x.FirstName1).DataType("string").HeaderText("FirstName1").Template("<div style='min-width:130px'>${FirstName1}</div> ").Hidden(true); column.For(x => x.LastName1).DataType("string").HeaderText("Last Name1").Template("<div style='min-width:130px'>${LastName1}</div> ").Hidden(true); column.For(x => x.Firstname2).DataType("string").HeaderText("First Name2").Hidden(true); column.For(x => x.Lastname2).DataType("string").HeaderText("Last Name2").Hidden(true); column.For(x => x.StreetNo).DataType("string").HeaderText("Street No").Template("<div style='min-width:100px'>${StreetNo}</div> ").Hidden(true); column.For(x => x.Street).DataType("string").HeaderText("Street").Template("<div style='min-width:100px'>${Street}</div> ").Hidden(true); column.For(x => x.Address).DataType("string").HeaderText("Address").Template("<div style='min-width:100px'>${Address}</div> "); column.For(x => x.City).DataType("string").HeaderText("City").Template("<div style='min-width:80px'>${City}</div> "); column.For(x => x.State).DataType("string").HeaderText("State").Template("<div style='min-width:80px'>${State}</div> "); column.For(x => x.Zipcode).DataType("string").HeaderText("Zipcode").Template("<div style='min-width:100px'>${Zipcode}</div> "); column.For(x => x.CustomerNumber).DataType("string").HeaderText("Customer Number").Hidden(true); column.For(x => x.AccountNumber).DataType("string").HeaderText("Account Number").Template("<div style='min-width:120px'>${AccountNumber}</div> "); column.For(x => x.Email1).DataType("string").HeaderText("Email1").Template("<div style='min-width:100px'>${Email1}</div> "); column.For(x => x.Email2).DataType("string").HeaderText("Email2").Template("<div style='min-width:100px'>${Email2}</div> "); column.For(x => x.Email3).DataType("string").HeaderText("Email3").Hidden(true); column.For(x => x.Email4).DataType("string").HeaderText("Email4").Hidden(true); //column.For(x => x.PartyId).DataType("string").HeaderText("PartyId"); column.For(x => x.PartyId1).HeaderText("PartyId").DataType("int").Hidden(true); }) .Features(features => { features.Responsive().ForceResponsiveGridWidth(false).EnableVerticalRendering(false).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("FullName").Classes("ui-visible-phone ui-visible-tablet ui-visible-desktop").Configuration(conf => conf.AddColumnModeConfiguration("phone", c => c.Template("<span>${FullName}</span>"))); setting.ColumnSetting().ColumnKey("telpremise").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("firstname1").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("telcell").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("street").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("address").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("lastname1").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("email1").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("address").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("zipcode").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("accountnumber").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("email2").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("city").Classes("ui-visible-desktop"); setting.ColumnSetting().ColumnKey("state").Classes("ui-hidden-phone"); setting.ColumnSetting().ColumnKey("PartyId1").Classes("ui-hidden-phone"); }); features.Hiding().HiddenColumnIndicatorHeaderWidth(14).ColumnSettings(s => s.ColumnSetting().ColumnKey("CompanyName").AllowHiding(true)); features.Resizing().AllowDoubleClickToResize(true).DeferredResizing(true); features.Paging().Type(OpType.Remote).PageSize(10).PrevPageLabelText("Prev").NextPageLabelText("Next").RecordCountKey("TotalRecordsCount"); features.Sorting().Type(OpType.Local).Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("PartyId").AllowSorting(true); }); features.RowSelectors().EnableCheckBoxes(true).EnableRowNumbering(false); features.Selection().MouseDragSelect(false).MultipleSelection(false).Mode(SelectionMode.Row); features.Filtering().Mode(FilterMode.Simple); features.Sorting().Type(OpType.Remote); }) .ColumnLayouts(layouts => { layouts.For(x => x.partyphonenumber) .Width("100%") .ForeignKey("PartyID") .AutoGenerateColumns(false) .RenderCheckboxes(true) .Columns(column => { column.For(x => x.ID).Hidden(true); column.For(x => x.PhoneNumber).DataType("string").HeaderText("Phone Number").Template("<div style='min-width:100px' class=${Template}>${PhoneNumber}</div> ").Width("15%"); column.For(x => x.Comment).DataType("string").HeaderText("Comment").Template("<div style='min-width:100px' class=${Template}>${Comment}</div> "); column.For(x => x.TypeName).DataType("string").HeaderText("Type").Template("<div style='min-width:100px' class=${Template}>${TypeName}</div> ").Width("18%"); column.For(x => x.Template).HeaderText("ID").Hidden(true); }) .PrimaryKey("ID") .DataMember("partyphonenumber") .Features(features => { features.Responsive().ForceResponsiveGridWidth(false).EnableVerticalRendering(false).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("PhoneNumber").Classes("ui-visible-phone ui-visible-tablet ui-visible-desktop").Configuration(conf => conf.AddColumnModeConfiguration("PhoneNumber", c => c.Template("<span>${PhoneNumber}</span>"))); }); features.Hiding().HiddenColumnIndicatorHeaderWidth(14).ColumnSettings(s => s.ColumnSetting().ColumnKey("PhoneNumber").AllowHiding(true)); features.Resizing().AllowDoubleClickToResize(true).DeferredResizing(true); features.Paging().Type(OpType.Local).PageSize(10).PrevPageLabelText("Prev").NextPageLabelText("Next"); features.Sorting().Type(OpType.Local).Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("ID").AllowSorting(true); }); features.RowSelectors().EnableCheckBoxes(false).EnableRowNumbering(false); features.Selection().MouseDragSelect(false).MultipleSelection(false).Mode(SelectionMode.Row); features.Filtering().Mode(FilterMode.Simple).ColumnSettings(setting => { setting.ColumnSetting().ColumnKey("PhoneNumber").AllowFiltering(false); setting.ColumnSetting().ColumnKey("Comment").AllowFiltering(false); setting.ColumnSetting().ColumnKey("TypeName").AllowFiltering(false); }); features.Sorting().Type(OpType.Local); }) .Width("auto") .ResponseDataKey("partyphonenumber"); }) //.ClientDataSourceType(ClientDataSourceType.JSON) .DataSourceUrl(Url.Action("GetAccountList")) .ResponseDataKey("Records") .Width("auto") .DataBind() .Render() )
and CS code is :
//[GridDataSourceAction] public ActionResult GetAccountList(int page , int pageSize) { int TotalRecordsCount = 0; // Session["Search"] = null; //Session["Condition"] = null; object searching = Session["Search"]; if (searching != null) { // Session["Search"] = null; if ((object)Session["Condition"] != null) { string condition = (string)Session["Condition"]; // Session["Condition"] = null; var searchlist = DBmain.GetSearchClientPaging(condition, page, pageSize, out TotalRecordsCount); this.GenerateSearchModel(searchlist); return Json(new { Records = searchlist, TotalRecordsCount = TotalRecordsCount }, JsonRequestBehavior.AllowGet); } else { var searchlist = DBmain.GetSearchClientPaging("", page, pageSize, out TotalRecordsCount); this.GenerateSearchModel(searchlist); return Json(new { Records = searchlist, TotalRecordsCount = TotalRecordsCount }, JsonRequestBehavior.AllowGet); } } else { List<Searchclient> ClientList = new List<Searchclient>(); return Json(new { Records = ClientList, TotalRecordsCount = 0 }, JsonRequestBehavior.AllowGet); } }
There is no error in console. only child grid is not rendering. Am I missing something?
Also we don't want to use [GridDataSourceAction] because there are millions of records in database, so we are only fetching 10 recrods to improve performance but when we are not using it searching and sorting is not working.
Below is the GET URL :
http://localhost:52211/Home/GetAccountList?sort(FullName)=asc&filter(FullName)=contains(sac)&filter(Address)=contains(river)&page=0&pageSize=10&%24select=FullName%2CCompanyName%2CFirstName1%2CLastName1%2CFirstname2%2CLastname2%2CStreetNo%2CStreet%2CAddress%2CCity%2CState%2CZipcode%2CCustomerNumber%2CAccountNumber%2CEmail1%2CEmail2%2CEmail3%2CEmail4%2CPartyId1%2Cpartyphonenumber&dbdepth=-1&pk=PartyId1&_=1561436422669
Please suggest about searching and sorting as well.
Thanks in Advance
As I am getting a little confused, let me clarify several things:
.ColumnLayouts(layouts => { layouts.For(x => x.ChildData) .Key("ChildData") .PrimaryKey("ProductID") .ForeignKey("ParentProdID") .Columns(childcolumn => { childcolumn.For(x => x.ProductID).HeaderText("ProductID").Width("170px"); childcolumn.For(x => x.Name).HeaderText("Name").Width("170px"); childcolumn.For(x => x.Name).HeaderText("New Name").Template("<input class='comboTask' data-value='${Name}'/>").Width("170px"); }).AddClientEvent(GridClientEvents.RowsRendered, "rowsRenderedChildAPT") .Features(features => { features.Sorting().Mode(SortingMode.Multiple); features.Paging().Type(OpType.Local).PageSize(8).ShowPageSizeDropDown(false).NextPageLabelText("Next").PrevPageLabelText("Prev"); }); })
This option lets you set the features, columns and options for the child grids. This might explain why your child grid do not render.
In case you use Entity Framework, using LINQ would create a single request to the DB and the [GridDataSourceAction] might still be applicable and performant for your controller method.
Otherwise the remote Paging, Sorting and Filtering (if this is what you refer to as “searching”?) would not work out-of-the-box and would have to be handled manually on the server.
There is a detailed help topic you may find useful, which shows handling remote Paging, Sorting, Filtering and Summaries.
Would you please elaborate some more on your concerns and why you do not want to use the [GridDataSourceAction] attribute?
Please let me know if you need some further assistance or some additional information.
Hi Vasil ,
Thanks for your reply . I am already using hierarchical ‘.ColumnLayouts’ option but it is not rendering. You can see the code in my previous reply.
The child grid is rendering fine when I use [GridDataSourceAction] attribute but when i am using custom paging it is not working. No error on browser console.
To bind the child grid data, I am looping over the records to get records for each parent, so if I use [GridDataSourceAction] and get all the records from database then it is taking too much time to bind child data. So have to use custom paging to get only 10/20 records from the database. We are using ADO.net.
I am attaching screenshot of UI with [GridDataSourceAction] attribute and without it.
The issue with the child grids not loading is probably caused by returning a JSON response that is structured differently, or the corresponding fields being empty when you are not using the [GridDataSourceAction] attribute.
Comparing the server responses when this attribute is present, and when it has been removed, would show you if there is such a difference. Try opening the browser DevTools, then the Network tab and then the “Response” pane. Here is a sample screenshot in Google Chrome:
Since the built-it beautifier in Chrome does not always work (at least on my side), you may want to use an online tool for the purpose, like this one. That way you would easily notice whether your custom logic returns the same hierarchically sctructured JSON data as when using [GradDataSourceAction], or not.
I look forward to hearing from you.
Thanks Vasil for guiding me in right direction.
In above reply you have directed me to this link https://www.igniteui.com/help/handling-remote-features-manually
But it only contains code in C#.
Do you have sample for SQL query for method available in above link for C# ApplyFilterExpr() and ApplySorting()?
Also definition for GetFilterExpressions() is not present in above link.