How To Sort The Column By Its Summary Value Alone In Jqgrid Grouping
I have the code available here: https://jsfiddle.net/zqLp4yrg/41/ datatype is 'local' not json. $('#jqGrid').jqGrid({ url: '/echo/json/', // use JSFiddle echo service post
Solution 1:
Your demo has many small problems:
- First of all you write about the usage of datatype is "local", but you use
datatype: "json"
in the demo. Moreover, you use noloadonce: true
option and noforceClientSorting: true
option. It means that the server is responsible for sorting the data. Moreover, if you use grouping, then the data returned from the server have to be sorted (on the server) by bothgroupingView.groupField
(CatId
in your case) and then bysortname
(RemainingQuantity
in your case). The data which you use as the source are not sorted correctly. One sees, for example, that jqGrid displays twoCatId: 2
and twoCatId: 3
groups. - You can fix the problem by adding
loadonce: true
andforceClientSorting: true
options, but you use old version of free jqGrid (4.11.1), which is not supportforceClientSorting: true
. You have to upgrade to the latest version (4.14.0) of free jqGrid to be able to sort and group the data returned from the server on the client before displaying. - The source data, which contains integer data will be returned from the server as strings. Moreover, some data items contains spaces (
" 16"
instead of"16"
or16
). It changes the order of sorting the data. - You should use
sorttype
(for examplesorttype: "integer"
) to sort the data in the column corresponds to the type of the data. - To sort the date column correctly you should use both
sorttype: "date"
and theformatter: "date"
with theformatoptions
(in you case:formatoptions: { srcformat: "d/m/Y H:i:s", newformat: "d/m/Y H:i:s" }
) - If you want that the options
rowNum
,rowList
andviewrecords
work, then the grid have to have at least one pager. Thus you probably skippager: true
ortoppager: true
(or both) options.
The fixed demo is https://jsfiddle.net/OlegKi/zqLp4yrg/43/. I removed groupingView.groupollapse: true
and height: 250
only to make easy to examine the results. The settings are not important for your main problem.
Post a Comment for "How To Sort The Column By Its Summary Value Alone In Jqgrid Grouping"