Problem with bSearchable boolean
Problem with bSearchable boolean
Hi,
I use Datatables 1.7.5 and everything works so far... except one thing: the "bSearchable" boolean. When I try to disable filtering on a column (with boolean set to false) it does nothing, I can still filter it.
This is strange because the "bVisible" boolean works perfectly ! So If somebody knows why or what is wrong in my code, please let me know :)
[code]
$(document).ready(function() {
$('#table-members').dataTable( {
"aaSorting": [[1, 'asc']],
"bJQueryUI": true,
"bProcessing": false,
"bServerSide": true,
"bStateSave": false,
"bAutoWidth": false,
"iDisplayLength": 50,
"sPaginationType": "full_numbers",
"sAjaxSource": "app/members/list.php",
"aoColumns": [
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "25%"},
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "20%"},
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "10%", "sClass": "center"},
{"bVisible": true, "bSearchable": true, "sWidth": "10%", "sClass": "center"},
{"bVisible": true, "bSearchable": true, "sWidth": "10%", "sClass": "center"},
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "20%"},
{"bVisible": true, "bSearchable": true, "sWidth": "5%","sClass": "center"}
]
} );
} );
[/code]
It's the default configuration from server side filtering :
[code]
/* Filtering */
$sWhere = "";
if ($_GET['sSearch'] != "")
{
$sWhere = "WHERE (";
for ($i=0; $i
I use Datatables 1.7.5 and everything works so far... except one thing: the "bSearchable" boolean. When I try to disable filtering on a column (with boolean set to false) it does nothing, I can still filter it.
This is strange because the "bVisible" boolean works perfectly ! So If somebody knows why or what is wrong in my code, please let me know :)
[code]
$(document).ready(function() {
$('#table-members').dataTable( {
"aaSorting": [[1, 'asc']],
"bJQueryUI": true,
"bProcessing": false,
"bServerSide": true,
"bStateSave": false,
"bAutoWidth": false,
"iDisplayLength": 50,
"sPaginationType": "full_numbers",
"sAjaxSource": "app/members/list.php",
"aoColumns": [
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "25%"},
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "20%"},
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "10%", "sClass": "center"},
{"bVisible": true, "bSearchable": true, "sWidth": "10%", "sClass": "center"},
{"bVisible": true, "bSearchable": true, "sWidth": "10%", "sClass": "center"},
{"bVisible": true, "bSearchable": false},
{"bVisible": true, "bSearchable": true, "sWidth": "20%"},
{"bVisible": true, "bSearchable": true, "sWidth": "5%","sClass": "center"}
]
} );
} );
[/code]
It's the default configuration from server side filtering :
[code]
/* Filtering */
$sWhere = "";
if ($_GET['sSearch'] != "")
{
$sWhere = "WHERE (";
for ($i=0; $i
This discussion has been closed.
Replies
[code]
/* Filtering */
$sWhere = "";
if ( $_GET['sSearch'] != "" )
{
$sWhere = "WHERE engine LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
"browser LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
"platform LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
"version LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ".
"grade LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%'";
}
[/code]
I'm using DataTables 1.8.2, and I've found this solution :
[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
*/
if ( $_GET['sSearch'] != "" )
{
$sWhere .= "AND (";
for ( $i=0 ; $i
$sWhere = "";
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i