I want to get data of jqGrid
in my controller. I am getting all data of jqGrid
using this
$("#gridSourceKey").jqGrid('getGridParam', 'data')
but I want filtered data in JSON format. How can I get it?
I want to get data of jqGrid
in my controller. I am getting all data of jqGrid
using this
$("#gridSourceKey").jqGrid('getGridParam', 'data')
but I want filtered data in JSON format. How can I get it?
The old version of jqGrid (jqGrid 4.3.2, which you use) provides no possibility to get filtered data. So you have to upgrade to free jqGrid and just use
$("#gridSourceKey").jqGrid('getGridParam', 'lastSelectedData')
instead of
$("#gridSourceKey").jqGrid('getGridParam', 'data')
Only if you really can't update jqGrid which you use then you should follow the tricky solution described in the answer. The solution consist from three steps: 1) overwriting (subclassing) the original internal jqGrid function $.jgrid.from
to the function which saves the last filtering results in local lastSelected
variable. 2) loadComplete
which places the results from the local lastSelected
variable to new custom jqGrid parameter lastSelected
. 3) the usage of $("#gridSourceKey").jqGrid('getGridParam', 'lastSelected')
.