Note that there are some explanatory texts on larger screens.

plurals
  1. POjqGrid: POST data to server to fetch row data (filtering and searching)
    primarykey
    data
    text
    <p>I have a form like this:</p> <pre><code>&lt;form id='myForm'&gt; &lt;input type='text' name='search' /&gt; &lt;input type='text' name='maxPrice' /&gt; &lt;/form&gt; </code></pre> <p>and table for my jqGrid:</p> <pre><code>&lt;table id='myGrid'&gt;&lt;/table&gt; </code></pre> <p>I need to POST (not GET) the data from <code>myForm</code> to my server method in order to fetch the row data and populate the grid. So far, I've not been able to get jqGrid to POST anything. I double-checked my data serialization and it is serializing my form data properly. Here is my jqGrid code:</p> <pre><code>$("#myGrid").jqGrid({ url: '/Products/Search") %&gt;', postData: $("#myForm").serialize(), datatype: "json", mtype: 'POST', colNames: ['Product Name', 'Price', 'Weight'], colModel: [ { name: 'ProductName', index: 'ProductName', width: 100, align: 'left' }, { name: 'Price', index: 'Price', width: 50, align: 'left' }, { name: 'Weight', index: 'Weight', width: 50, align: 'left' } ], rowNum: 20, rowList: [10, 20, 30], imgpath: gridimgpath, height: 'auto', width: '700', //pager: $('#pager'), sortname: 'ProductName', viewrecords: true, sortorder: "desc", caption: "Products", ajaxGridOptions: { contentType: "application/json" }, headertitles: true, sortable: true, jsonReader: { repeatitems: false, root: function(obj) { return obj.Items; }, page: function(obj) { return obj.CurrentPage; }, total: function(obj) { return obj.TotalPages; }, records: function(obj) { return obj.ItemCount; }, id: "ProductId" } }); </code></pre> <p>Can you see what I'm doing wrong or should be doing differently?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload