Error in filter heading
Error in filter heading
Hi,
I am trying to move the filter(select) filter from tfooter in the api example to thead and used TD instead of TH tag in the thead for the select filter holder. What happened is when I initialize the table it add one row in the body, a duplicate of the td values in the thead and it is counted as td in the thead making the total count double.
Here is my table declaration
[code]
Dimension
Fixture Type
Lamp Type
Lamp Qty
Mounting Type
Socket Type
Lamp Wattage
Type ID
t01
t02
t03
t04
t05
t06
t07
t08
[/code]
here is my initialization
[code]
alert($("#fixture_filters000 td").length);
$("#fixture_filters000 td").each( function ( i ) {
/*
x=$(this).parent().get(0);
x=$(x).parent().get(0);
//alert(i+':'+$(x).parent().get(0).id);
alert(el.id);
*/
this.innerHTML = fnCreateSelect( fixture_table_filter.fnGetColumnData(i) );
$('select', this).change( function () {
fixture_table_filter.fnFilter( $(this).val(), i );
re_create_select();
} );
} );
alert($("#fixture_filters000 td").length);
[/code]
as you can see I put alerts before and after the initialization. Before the init, the count is 8 but after the init its already 16
here is a screenshot of the result
http://farm5.static.flickr.com/4064/4672572941_ae4a4c6446_b.jpg
If you noticed that the header has the select filters and another row below it the original values (t01-t08) which is now the first record in the table, meaning it's not on the head any more.
BTW, Im using the latest release on FF & chrome
thanks
Florante
I am trying to move the filter(select) filter from tfooter in the api example to thead and used TD instead of TH tag in the thead for the select filter holder. What happened is when I initialize the table it add one row in the body, a duplicate of the td values in the thead and it is counted as td in the thead making the total count double.
Here is my table declaration
[code]
Dimension
Fixture Type
Lamp Type
Lamp Qty
Mounting Type
Socket Type
Lamp Wattage
Type ID
t01
t02
t03
t04
t05
t06
t07
t08
[/code]
here is my initialization
[code]
alert($("#fixture_filters000 td").length);
$("#fixture_filters000 td").each( function ( i ) {
/*
x=$(this).parent().get(0);
x=$(x).parent().get(0);
//alert(i+':'+$(x).parent().get(0).id);
alert(el.id);
*/
this.innerHTML = fnCreateSelect( fixture_table_filter.fnGetColumnData(i) );
$('select', this).change( function () {
fixture_table_filter.fnFilter( $(this).val(), i );
re_create_select();
} );
} );
alert($("#fixture_filters000 td").length);
[/code]
as you can see I put alerts before and after the initialization. Before the init, the count is 8 but after the init its already 16
here is a screenshot of the result
http://farm5.static.flickr.com/4064/4672572941_ae4a4c6446_b.jpg
If you noticed that the header has the select filters and another row below it the original values (t01-t08) which is now the first record in the table, meaning it's not on the head any more.
BTW, Im using the latest release on FF & chrome
thanks
Florante
This discussion has been closed.
Replies
alert($("#fixture_filters000 td").length);
fixture_table_filter = $('#fixture_table_id').dataTable( {
"sSearch": "Search all columns:",
"sScrollX": "100%",
"sScrollY": "300",
"bProcessing": "true",
"bServerSide": "true",
// "aaSorting": [[0,'asc']],
"sAjaxSource": 'get_fixture.php',
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "projectID", "value": projectID__ } );
aoData.push( { "name": "operation", "value": 3 } );
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
} );
alert($("#fixture_filters000 td").length);
[/code]
As you can see, it created two table with the same ID.
http://farm2.static.flickr.com/1281/4673952392_f27a3b8e6a_b.jpg
Allan
thank you very much for your very quick help.
I have downloaded the beta2 now and it did resolved that double ID issue of the table but the resulting table heading is not ignoring the TD in the thead.
here is the rendered table
http://farm2.static.flickr.com/1276/4673951975_f18c14fd71_b.jpg
And here is the firebug screen.
http://farm5.static.flickr.com/4050/4674575716_f7e0c8c2e5_b.jpg
I do not think that I am doing the right think here on adding the filter on top. can you help Alan?
Thanks
Florante
I think there is a bug in the beta regarding this (a different one from the original beta :-/ ). It doesn't do a very good job of dealing with TD elements in the header at the moment (in fact it complete ignores them...). This is something I will be looking to fix with the next beta... Sorry I don't have better news at the moment.
Allan
Thank you very much. That's a very good thing to look forward too.
Florante