Filtering with "multiple select" with multiple table
Filtering with "multiple select" with multiple table
Hello everyone, I'm french and I need your help.
I want to have 3 tables on the same page and a "multiple select" to filtering one column on my tables (for example : column "engine version").
I call my table on my database like this :
[code]
TABLE 1
CAMERA
Browser
Plateform
Engine version
CSS grade
<?php
$sql_variable = $bdd->query("SELECT * FROM my_table");
//----------------------------------------------------------------
while ($variable = $sql_variable->fetch())
{
?>
<?php echo $variable['browser']; ?>
<?php echo $variable['plateform']; ?>
<?php echo $variable['engine_version']; ?>
<?php echo $variable['css_grade']; ?>
<?php
}
//----------------------------------------------------------------
$sql_variable->closeCursor();
?>
[/code]
I would like this : http://dl.dropbox.com/u/21672921/table.jpg
Can you give me an example which work ? :)
Thank you ! and sorry for my english...
I want to have 3 tables on the same page and a "multiple select" to filtering one column on my tables (for example : column "engine version").
I call my table on my database like this :
[code]
TABLE 1
CAMERA
Browser
Plateform
Engine version
CSS grade
<?php
$sql_variable = $bdd->query("SELECT * FROM my_table");
//----------------------------------------------------------------
while ($variable = $sql_variable->fetch())
{
?>
<?php echo $variable['browser']; ?>
<?php echo $variable['plateform']; ?>
<?php echo $variable['engine_version']; ?>
<?php echo $variable['css_grade']; ?>
<?php
}
//----------------------------------------------------------------
$sql_variable->closeCursor();
?>
[/code]
I would like this : http://dl.dropbox.com/u/21672921/table.jpg
Can you give me an example which work ? :)
Thank you ! and sorry for my english...
This discussion has been closed.
Replies
Please this is important and I am very interested in this post.
Thanks
Allan
I do not understand how to work fnfilterAll to filter a single column for all tables.
I am inspired by this, I think this is very close to what I want to do : http://datatables.net/examples/api/regex.html
I would have exactly this page but, with several tables, the filteringAll enter in conflict with the column filtering ...
I await your suggestions!
Thanks
oTable.fnFilterAll( "filter_value", columnIndex /*i.e. 2 or 3 etc */, false );
[/code]
where oTable is the DataTables instance.
Allan
I try with an input before doing it with a select, but "filter_value" is not good :
[code]
/* copy and paste : I did not understand this function */
$.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bEscapeRegex) {
for (var i in this.dataTableSettings) {
jQuery.fn.dataTableExt.iApiIndex = i;
this.fnFilter(sInput, iColumn, bEscapeRegex);
}
}
$(document).ready(function() {
$("#filter_col3").keyup( function ()
{
$(".table_a_filtrer").dataTable().fnFilterAll(this.value,3,false); /* 'this.value' doesn't work... ? */
} );
[/code]
Thank you for your time allan !
Allan
Maybe there is an conflict with my display ?
This is all my code, if you find a big error... thank you very much :)
[code]
$.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bEscapeRegex) {
for (var i in this.dataTableSettings) {
jQuery.fn.dataTableExt.iApiIndex = i;
this.fnFilter(sInput, iColumn, bEscapeRegex);
}
}
$(document).ready(function()
{
/* Filtre g
It's ok, thank you very much allan !
My problem is my "id" :in html I have "col3_filter" and in jquery I have "filter_col3" !
I am ashamed^^
I will now try to convert this input to select MULTIPLE...
I certainly need help, this is not the first time that I asked this question on this forum.
Anyway, I go to the next step!
thank you
I can not find answers on the internet.
[code]
$("#col5_filter").change( function ()
{
$("select[id='col5_filter'] option:selected").each(function() {
/*here*/
});
$(".table_a_filtrer").dataTable().fnFilterAll(/* and here*/,4,false);
} );
[/code]
What should I put in this code in order to have something like this:
[code]
$('#example').dataTable().fnFilter( 'option1|option2|...|optionN ',columnNo,false);
[/code]
-----------------------------------
Pending a response, I continued searching and I try to understand how to read array directly jquery because I think that in php, I want something like this :
[code]
foreach($col5_filter[] as $test)
{
$condition = $condition.(($marqueur==0) ? $test : ' | '.$test);
$marqueur++;
}
[/code]
if you do not understand php code, ignore it!
-----------------------------------
Thanks