title: ignited datatables search not working with server side processing
body: <p>Data is showing fine, but search filter not working.
  Im using Codeigniter with Ignited Datatables.</p>
  
  <p>Here is my HTML code or View file you may say.</p>
  
  <pre><code>                        &lt;table id="ManageForms" class="table table-bordered table-condensed table-hover table-striped"&gt;
                          &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;Form Name&lt;/th&gt;
                              &lt;th&gt;Form Path&lt;/th&gt;
                              &lt;th&gt;Form CI Path&lt;/th&gt;
                              &lt;th&gt;Actions&lt;/th&gt;
                          &lt;/tr&gt;
                          &lt;/thead&gt;
  &lt;tbody&gt;&lt;/tbody&gt;
                          &lt;/table&gt;
      &lt;script&gt;
          $(document).ready(function() {
              $('#ManageForms').dataTable({
  
                  "bServerSide":true,
                  "bProcessing":true,
                  "sPaginationType": "full_numbers",
                  "bFilter":true,
                  "sServerMethod": "POST",
                  "sAjaxSource": "{{base_url()}}admin/configurations/listForms_DT/",
                  "iDisplayLength": 2,
                  "aLengthMenu": [[2, 25, 50, -1], [2, 25, 50, "All"]],
                  "sEcho": 1,
                  "columns":[
                      {data:"FormName"},
                      {data:"FormPath"},
                      {data:"FormCIPath"},
                      { "data": null,
                          "defaultContent": "&lt;button&gt;Edit&lt;/button&gt;",
                          "targets": -1
                      }
                  ],
                  'fnServerData'   : function(sSource, aoData, fnCallback){
                      $.ajax ({
                          'dataType': 'json',
                          'type'    : 'POST',
                          'url'     : sSource,
                          'data'    : aoData,
                          'success' : fnCallback
                      }); //end of ajax
                  }
  
              });
          } );
      &lt;/script&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code> function listForms_DT(){
  $this-&gt;datatables-&gt;select('FormID, FormName, FormPath, FormCIPath')
           -&gt;unset_column('FormID')
           -&gt;from('sys_forms');
       echo $this-&gt;datatables-&gt;generate();
  }//end of list_forms_view
  
  }
  </code></pre>
  
  <p>The Ignited Datatables Library Function, where it seems to have the problem</p>
  
  <pre><code>public function generate($output = 'json', $charset = 'UTF-8')
  {
    if(strtolower($output) == 'json')
      $this-&gt;get_paging();
  
    $this-&gt;get_ordering();
    $this-&gt;get_filtering();
    return $this-&gt;produce_output(strtolower($output), strtolower($charset));
  }
  
  /**
  * Generates the LIMIT portion of the query
  *
  * @return mixed
  */
  private function get_paging()
  {
    $iStart = $this-&gt;ci-&gt;input-&gt;post('iDisplayStart');
    $iLength = $this-&gt;ci-&gt;input-&gt;post('iDisplayLength');
  
    if($iLength != '' &amp;&amp; $iLength != '-1')
      $this-&gt;ci-&gt;db-&gt;limit($iLength, ($iStart)? $iStart : 0);
  }
  
  /**
  * Generates the ORDER BY portion of the query
  *
  * @return mixed
  */
  private function get_ordering()
  {
  
    $Data = $this-&gt;ci-&gt;input-&gt;post('columns');
  
  
    if ($this-&gt;ci-&gt;input-&gt;post('order'))
      foreach ($this-&gt;ci-&gt;input-&gt;post('order') as $key) 
        if($this-&gt;check_cType())
          $this-&gt;ci-&gt;db-&gt;order_by($Data[$key['column']]['data'], $key['dir']);
        else
          $this-&gt;ci-&gt;db-&gt;order_by($this-&gt;columns[$key['column']] , $key['dir']);
  
  }
  
  /**
  * Generates a %LIKE% portion of the query
  *
  * @return mixed
  */
  private function get_filtering()
  {
    $mColArray = $this-&gt;ci-&gt;input-&gt;post('iColumns');
    $sWhere = '';
    $search = $this-&gt;ci-&gt;input-&gt;post('search');
    $sSearch = $this-&gt;ci-&gt;db-&gt;escape_like_str(trim($search['value']));
    $columns = array_values(array_diff($this-&gt;columns, $this-&gt;unset_columns));
  
    if($sSearch != '' &amp;&amp; $sSearch != 0)
      for($i = 0; $i &lt; count($mColArray); $i++)
        if($mColArray[$i]['searchable'] == 'true' )
          if($this-&gt;check_cType())
            $sWhere .= $this-&gt;select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' OR ";
          else
            $sWhere .= $this-&gt;select[$this-&gt;columns[$i]] . " LIKE '%" . $sSearch . "%' OR ";
  
  
    $sWhere = substr_replace($sWhere, '', -3);
  
    if($sWhere != '')
      $this-&gt;ci-&gt;db-&gt;where('(' . $sWhere . ')');
  
    // TODO : sRangeSeparator
  
    foreach($this-&gt;filter as $val)
      $this-&gt;ci-&gt;db-&gt;where($val[0], $val[1], $val[2]);
  }
  </code></pre>
  
  <p>Now finally the Post Parameters</p>
  
  <pre><code>bRegex  false
  bRegex_0    false
  bRegex_1    false
  bRegex_2    false
  bRegex_3    false
  bSearchable_0   true
  bSearchable_1   true
  bSearchable_2   true
  bSearchable_3   true
  bSortable_0 true
  bSortable_1 true
  bSortable_2 true
  bSortable_3 true
  iColumns    4
  iDisplayLength  2
  iDisplayStart   0
  iSortCol_0  0
  iSortingCols    1
  mDataProp_0 FormName
  mDataProp_1 FormPath
  mDataProp_2 FormCIPath
  mDataProp_3 
  sColumns    ,,,
  sEcho   1
  sSearch 
  sSearch_0   
  sSearch_1   
  sSearch_2   
  sSearch_3   
  sSortDir_0  asc
  </code></pre>
  
  <p>The problem where is seems to me is that my datatables is posting sSearch but in the ignitedDatables, it is looking for search</p>
  
  <p>Ignited Datatables library, get_filtering function.
      $search = $this->ci->input->post('search');</p>
  
  <p>so i tried changing it to </p>
  
  <pre><code>$search = $this-&gt;ci-&gt;input-&gt;post('sSearch');
  </code></pre>
  
  <p>after that my datatables even stopped me showing the data it was showing before. so i had to reverse back to search..</p>
  
  <p>Please if anyone have any expertise, explain me what is it i am doing wrong here.</p>