fnFILTER
fnFILTER
I am using "bServerSide": true. I have read in the forum that any client side filter is irrelevant.
On the other hand, if I type something in the search box works very good. I did also use a default value for this box with "oSearch": {"sSearch": "Initial search"} and works very good as well.
But I need to filter only one column.
I wonder how can I set up a default column filter like oTable.fnFilter(16,1) or better just ask the right values to the table using SELECT WHERE.
On the other hand, if I type something in the search box works very good. I did also use a default value for this box with "oSearch": {"sSearch": "Initial search"} and works very good as well.
But I need to filter only one column.
I wonder how can I set up a default column filter like oTable.fnFilter(16,1) or better just ask the right values to the table using SELECT WHERE.
This discussion has been closed.
Replies
Allan
Can not make it run. I did try with client proceesing and use oTable.fnFiler('example') but nothing happend not even an error. Of course I know it is my fault.
BUT
I case I want to use datatable with not a full table just a query...which I asume will be much simple and fast
.
Using PHP in my old days I use to code lke this:
// The query
$q= SELECT T1.value1, T2.value1 FROM table1 as T1, table2 as T2 WHERE T1.f >= '2013-01-04' AND T1.f <= '2013-09-01' GROUP BY T2.value5 ORDER BY T1.value1 DESC";
$r = mysql_query($q);
//PRINT it in screen
while ($line = mysql_fetch_array($r, MYSQL_BOTH))
{
echo " . $line[0] . "|
";
}
My problem is how to give the data from the query to datatables.
Just give me a clue and I will follow
Allan
"bProcessing": true,
"sServerMethod": "POST",
"sDom": "Tlfrtip ",
"sAjaxSource": "php/table.EEcarpetas.php",
"aoColumns": [
{"mData": "numero", "sDefaultContent": " ", "bSearchable": true},
{"mData": "proyectos.codigoee", "sDefaultContent": " ", "bSearchable":true},
{"mData": "descrip", "sDefaultContent": " ", "bSearchable": true },
{"mData": "info", "sDefaultContent": " ", "bSearchable": true},
],
"oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
},
"fnInitComplete": function ( settings, json ) {
// Set the allowed values for the select and radio fields based on
// what is available in the database
editor.field('idproyecto').update( json.proyectos);
}
} );
oTable.fnFilter('Dock',2);
Also is this with the Editor libraries? YES
BUT again more problems came up because when you use number one (1) as filter a numeric column...obviously all numbers having 1 will appear.
Any clue to filter the 1 as number and not as a part of a string?? I mean, I want to show only the rows which have this field equal to 1.
You've got all columns searchable - but you said you only wanted one searchable?
> Any clue to filter the 1 as number and not as a part of a string?? I mean, I want to show only the rows which have this field equal to 1.
With client-side filtering you'd use a regular expression - with server-side you'd need to actually modify the libraries - it is hardcoded in that the SQL WHERE condition is `%{search}%` - so yes, anything with a 1 in it would match.
Allan