I have a wcf service for a lot of reports that return json data in jqgrid. Everything works as expected. However, due to the large number of user inputs for each report request, I decided to use the json string, which corresponds to the series of input models that I have installed on the server. I donβt want to mess with long complex query strings on my routes.
Question: How can I add jqGrid query string parameters so that my json string is loaded onto the server? I tried loadBeforeSend, but I cannot override the ajax url. I cannot use the function for the url parameter, because the grid parameters are not yet available. Any ideas? Thanks.
My jqGrid function (short for short):
function loadGrid() { var tbl = $('#tbl'); tbl.jqGrid({ loadBeforeSend: function () { var ai = { dateFrom: dbDateTime($('#at-datefrom').val()), dateTo: dbDateTime($('#at-dateto').val()), sidx: tbl.getGridParam('sortname'), sord: tbl.getGridParam('sortorder'), page: tbl.getGridParam('page'), rows: tbl.getGridParam('rowNum') }; var newUrl = getBaseURL() + 'ReportingService.svc/report/?json=' + JSON.stringify(ai); tbl.jqGrid().setGridParam({ url: newUrl });
source share