JqGrid Error: Asc is not a column
As linked here :http://trirand.net/forum/default.aspx?g=posts&t=909, there is an issue with sorting with grouping.
Say in your controller you have something similar to this:
public ActionResult _JqGridGetData(string sidx = "", string sord = "", int page = 1, int rows = 0)
{
//https://github.com/kahanu/System.Linq.Dynamic
if (!String.IsNullOrWhiteSpace(sidx))
{
res = res.OrderBy(String.Format("{0} {1}", sidx, sord)).AsQueryable();
}
...
}
you may encounter an error where sidx is of the form "[col] [sort]," and then sord is "[sord]", and it may look something like "rID asc, asc".
The resolution that I found is that when you are grouping and failed to specify the sortname and sortorder properies for the jqgrid this error will occur. Once you specify the properties like below the problem should disappear.
jQuery(document).ready(function () {
$("#grid").jqGrid({
url: '@Url.Action("_JqGridGetData", "controllerName")',
sortname: "repNumber",
sortorder: "ASC",
......
}
Say in your controller you have something similar to this:
public ActionResult _JqGridGetData(string sidx = "", string sord = "", int page = 1, int rows = 0)
{
//https://github.com/kahanu/System.Linq.Dynamic
if (!String.IsNullOrWhiteSpace(sidx))
{
res = res.OrderBy(String.Format("{0} {1}", sidx, sord)).AsQueryable();
}
...
}
you may encounter an error where sidx is of the form "[col] [sort]," and then sord is "[sord]", and it may look something like "rID asc, asc".
The resolution that I found is that when you are grouping and failed to specify the sortname and sortorder properies for the jqgrid this error will occur. Once you specify the properties like below the problem should disappear.
jQuery(document).ready(function () {
$("#grid").jqGrid({
url: '@Url.Action("_JqGridGetData", "controllerName")',
sortname: "repNumber",
sortorder: "ASC",
......
}
Comments
Post a Comment