bSearchable issue
bSearchable issue
paky
Posts: 106Questions: 0Answers: 0
Why my columnDefs are false on bSearchable param and my dtable continue to search on that columns ? Thanks
This discussion has been closed.
Replies
Allan
[code]
/*
* Filtering
* NOTE this does not match the built-in DataTables filtering which does it
* word by word on any field. It's possible to do here, but concerned about efficiency
* on very large tables, and MySQL's regex functionality is very limited
*/
$sWhere = "";
if (isset($_GET['sSearch']) && $_GET['sSearch'] != "") {
$sWhere = "WHERE (";
for ($i = 0; $i < count($aColumns); $i++) {
/*
* Qui salto il where sul settimo campo
* (DATE_FORMAT((DATE_ADD(MAX(tbl_progetto.presa_in_carico_data),INTERVAL 12 DAY)),'%d-%M-%Y'))
*
*/
if($i!=7)
{
$sWhere .= $aColumns[$i] . " LIKE '%" . mysql_escape_string($_GET['sSearch']) . "%' OR ";
}
}
$sWhere = substr_replace($sWhere, "", -3);
$sWhere .= ')';
}
/* Individual column filtering */
for ($i = 0; $i < count($aColumns); $i++) {
if (isset($_GET['bSearchable_' . $i]) && $_GET['bSearchable_' . $i] == "true" && $_GET['sSearch_' . $i] != '') {
if ($sWhere == "") {
$sWhere = "WHERE ";
} else {
$sWhere .= " AND ";
}
$sWhere .= $aColumns[$i] . " LIKE '%" . mysql_escape_string($_GET['sSearch_' . $i]) . "%' ";
}
}
[/code]
Allan
Allan