JQuery jqgrid not sorting on client side

前端 未结 2 1427
名媛妹妹
名媛妹妹 2020-12-17 04:13

The data loads fine into the grid, but it won\'t sort.

When I click in the table header, the sort arrows appear, but the data\'s not being sorted.

Thanks.

2条回答
  •  -上瘾入骨i
    2020-12-17 04:28

    The code you posted shows that the sorting will be done on the server not on the client. Your jqGrid will post sord and sidx parameters to allow you to do so as part of returning the data to the jqGrid.

    Ex: C# MVC Controller code, where paging is also performed

    public ActionResult GetGridData(string sidx, string sord, int page, int rows, bool _search, string filters)
    {
     ...
     var pagedQuery = wholeDataSet.OrderBy(sidx + " " + sord).Skip((page - 1) * rows).Take(rows).ToList();
     ...
    

提交回复
热议问题