Error in filter heading

Error in filter heading

floranteflorante Posts: 8Questions: 0Answers: 0
edited June 2010 in General
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

Replies

  • floranteflorante Posts: 8Questions: 0Answers: 0
    [code]
    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]
  • floranteflorante Posts: 8Questions: 0Answers: 0
    here is the firebug capture of the table structure.

    As you can see, it created two table with the same ID.

    http://farm2.static.flickr.com/1281/4673952392_f27a3b8e6a_b.jpg
  • allanallan Posts: 63,405Questions: 1Answers: 10,452 Site admin
    Are you using 1.7.0 beta 2? There was a bug in the first beta which caused the duplicate IDs to be created - this has now been fixed. I've not actually tried something like this filtering in the header myself with scrolling in 1.7 beta 2 yet, but I will do so to see if there is a wider problem that needs to be addressed.

    Allan
  • floranteflorante Posts: 8Questions: 0Answers: 0
    Hi 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
  • allanallan Posts: 63,405Questions: 1Answers: 10,452 Site admin
    Hi 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
  • floranteflorante Posts: 8Questions: 0Answers: 0
    Hi Alan,

    Thank you very much. That's a very good thing to look forward too.

    Florante
This discussion has been closed.