Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you use the searching toolbar you can use <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching#calling_convention" rel="nofollow noreferrer">beforeSearch</a> callback to modify the <code>postData.filter</code>. In case of Singe Field searching or Advanced Searching you can use <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:singe_searching#options" rel="nofollow noreferrer">onSearch</a>.</p> <p>In <a href="https://stackoverflow.com/a/8953934/315935">the answer</a> you can see how the <code>postData.filter</code> can be modified.</p> <p><strong>UPDATED</strong>: You did something wrong in your tests. The only problem is that the current implementation of searching don't initialize <code>this</code> to the grid, but it's not explicitly documented somewhere.</p> <p>I created <a href="http://www.ok-soft-gmbh.com/jqGrid/ModifyFilterOnSearch.htm" rel="nofollow noreferrer">the demo</a> for you which demonstrate that you do can modify the filter before relaoding of the grid will be started. If you would search in the grid for 'Client' equal to 300 the search request will be modified to 'amount' equal to 300 and you would see the results</p> <p><img src="https://i.stack.imgur.com/6nKGj.png" alt="enter image description here"></p> <p>The corresponding code is</p> <pre class="lang-js prettyprint-override"><code>$('#list').jqGrid('navGrid', '#pager', {add: false, edit: false, del: false}, {}, {}, {}, { multipleSearch: true, overlay: 0, onSearch: function () { var i, l, rules, rule, $grid = $('#list'), postData = $grid.jqGrid('getGridParam', 'postData'), filters = $.parseJSON(postData.filters); if (filters &amp;&amp; typeof filters.rules !== 'undefined' &amp;&amp; filters.rules.length &gt; 0) { rules = filters.rules; for (i = 0; i &lt; rules.length; i++) { rule = rules[i]; if (rule.field === 'name') { // make modifications only for the 'contains' operation rule.field = 'amount'; } } postData.filters = JSON.stringify(filters); } }}); </code></pre>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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