title: How to implement live search in jqgrid plugin?
body: <p>What is the true way to implement 'keypress'-filtering in jqgrid plugin?
  I have text input field and i need filter results on keypress in this input by custom jqgrid-table columns.</p>
  
  <p>filterToolbar method added search field for each column, but i need to one global search field for filtering by three custom columns.</p>
  
  <p>For example:</p>
  
  <pre><code>grid.jqGrid({
      url: '/url/to/json',
      datatype: 'json',
      loadonce: true,
      colModel: [
          { label: 'Last Modified', name: 'lastModified', width: 15, sorttype: 'date' },
          { label: 'Campaign Name', name: 'name', width: 35, sorttype: 'text' },
          { label: 'Camp ID', name: 'id', align: 'left', width: 10, sorttype: 'integer' },
          { label: 'Advertiser', name: 'advertiser', width: 15, sorttype: 'text' },
          { label: 'Status', name: 'status', width: 10, sorttype: 'text' },
          { label: 'Flight Dates', name: 'startDate', width: 15, sorttype: 'date' }
      ],
      autowidth: true,
      ...
  });
  </code></pre>
  
  <p>I need to live sort the table by 'name' and 'advertiser' attributes. </p>
  
  <p>UPD. I found the <a href="http://www.ok-soft-gmbh.com/jqGrid/OneFieldSearching.htm" rel="nofollow">answer</a>, but it does not work in my jqGrid table. 
  My code here:</p>
  
  <pre><code>var grid = $("#jqGrid");
  
              grid.jqGrid({
                  url: '/reportingservice/api/cmp/tagCampaignList',
                  datatype: 'json',
                  loadonce: true,
                  colModel: [
                      { label: 'Last Modified', name: 'lastModified', width: 15, sorttype: 'date', search: false },
                      { label: 'Campaign Name', name: 'name', width: 35, sorttype: 'text', formatter: urlFormat },
                      { label: 'Camp ID', name: 'id', align: 'left', width: 10, sorttype: 'integer', search: false },
                      { label: 'Advertiser', name: 'advertiser', width: 15, sorttype: 'text' },
                      { label: 'Status', name: 'status', width: 10, sorttype: 'text' },
                      { label: 'Flight Dates', name: 'flightDates', width: 15, sorttype: 'date', search: false }
                  ],
                  autowidth: true,
                  height: 500,
                  resizable: false,
                  rowNum: 50,
                  groupColumnShow: false,
                  pager: '#jqGridPager',
                  pgtext: '{0}',
                  toolbar: [true, "top"],
                  loadComplete: function () {
                  }
              });
  
              // live search
              $('#t_' + $.jgrid.jqID(grid[0].id))
                  .append($("&lt;div&gt;&lt;label for=\"globalSearchText\"&gt;Global search in grid for:&amp;nbsp;" +
                      "&lt;/label&gt;&lt;input id=\"globalSearchText\" type=\"text\"&gt;&lt;/input&gt;&amp;nbsp;" +
                      "&lt;button id=\"globalSearch\" type=\"button\"&gt;Search&lt;/button&gt;&lt;/div&gt;"));
  
  
              $("#globalSearchText").keypress(function (e) {
                  var key = e.charCode || e.keyCode || 0;
                  if (key === $.ui.keyCode.ENTER) { // 13
                      $("#globalSearch").click();
                  }
              });
  
              $("#globalSearch").button({
                  icons: { primary: "ui-icon-search" },
                  text: false
              }).click(function () {
                  var rules = [], i, cm,
                      postData = grid.jqGrid("getGridParam", "postData"),
                      colModel = grid.jqGrid("getGridParam", "colModel"),
                      searchText = $("#globalSearchText").val(),
                      l = colModel.length;
  
                  console.log(searchText);
  
                  for (i = 0; i &lt; l; i++) {
                      cm = colModel[i];
                      if (cm.search !== false &amp;&amp; (cm.stype === undefined || cm.stype === "text")) {
                          rules.push({
                              field: cm.name,
                              op: "cn",
                              data: searchText
                          });
                      }
                  }
                  postData.filters = JSON.stringify({
                      groupOp: "OR",
                      rules: rules
                  });
                  grid.jqGrid("setGridParam", { search: true });
                  grid.trigger("reloadGrid", [
                      {page: 1, current: true}
                  ]);
                  return false;
              });
  </code></pre>