IgnitedDatatables / Ignited-Datatables

Ignited Datatables is a wrapper class/library based on the native Datatables server-side implementation by Allan Jardine found at http://datatables.net/examples/data_sources/server_side.html for CodeIgniter
285 stars 335 forks source link

Problem + solution with GROUP_CONCAT + Search #108

Open wrabit opened 8 years ago

wrabit commented 8 years ago

Using Group_concat in the datatables query was breaking when using serverSide: true and searching.

This is a snippet to replace to get this working: (around Ln: 323 in Datatables.php)

  if($sSearch != '')
    for($i = 0; $i < count($mColArray); $i++)
      if($mColArray[$i]['searchable'] == 'true' )
        if($this->check_cType()) {
          if( strpos($this->select[$mColArray[$i]['data']], 'GROUP_CONCAT') !== false ) continue;
          $sWhere .= $this->select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' OR ";
        } else {
          if( strpos($this->select[$mColArray[$i]['data']], 'GROUP_CONCAT') !== false ) continue;
          $sWhere .= $this->select[$this->columns[$i]] . " LIKE '%" . $sSearch . "%' OR ";
        }
haider-pw commented 8 years ago

for which version this change i can add to..

buoncri commented 7 years ago

I have tryed to replace the code, but it seems not working. Can someone post the whole function (I think get_filtering) so i replace with no dubt of what to replace ? :-D

Thanks in advance

wrabit commented 6 years ago

You could also just set "searchable: false" on the column from the front end.