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,
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.
I would suggest that you take a look at the Remote Features online sample – the code for the GetFilterExpressions method is available there, just click the “ASP.NET Controller” tab.
Regarding the SQL queries: the Infragistics controls handle the UI part of an application, hence we do not have such SQL samples, and we do not provide support for database related topics, as it goes beyond the scope of our Support.
On a side note: There is a tool called LinqPad, which has a free version, and has an option to convert LINQ to SQL that you may find useful. There is a Medium post that shows how it is done in more details.
Thanks Vasil. You are a life saver