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
Escape Wildcard Characters in get_filtering() method #135
Search values that contain '%' or '_' will not return results. From Code Igniter guides:
The escape_like_str() method uses ‘!’ (exclamation mark) to escape special characters for LIKE conditions. Because this method escapes partial strings that you would wrap in quotes yourself, it cannot automatically add the ESCAPE '!' condition for you, and so you’ll have to manually do that.
change
$sWhere .= $this->select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' OR ";
to:
$sWhere .= $this->select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' ESCAPE '!' OR ";
and
$sWhere .= $this->select[$this->columns[$i]] . " LIKE '%" . $sSearch . "%' OR ";
to:
$sWhere .= $this->select[$this->columns[$i]] . " LIKE '%" . $sSearch . "%' ESCAPE '!' OR ";
Search values that contain '%' or '_' will not return results. From Code Igniter guides:
change
to:
and
to: