update problems from version 1.5.0 beta 9 to 1.6.2

update problems from version 1.5.0 beta 9 to 1.6.2

Phil HPhil H Posts: 20Questions: 0Answers: 0
edited April 2010 in Bug reports
Hi Allan,

I have just updated from version 1.5.0 beta 9 to 1.6.2 and some strange things have started to happen

Most pages with DataTables load just fine .. but one page generates the following error message but only in Internet Explorer

"DataTables warning: Unexpected number of TD elements, Expected X and got Y. DataTables does not support rowspan / colspan in the table body, there must be one cell for each row / column combination.

I had a colspan in the header but even with that removed I get the same error. I have managed to isolate the problem down to one table but the HTML looks fine. Is this a known problem ? I can recreate the same error in Mozilla if I have statement in the table header.

I also have a problem with the FixedHeader routine. In Mozilla it works really well but in Internet Explorer the header gets added to the bottom of the screen rather than the top of the table. Is this is a problem that has been reported before ?

Many thanks for a great product, I'm sure these problems are more down to my dodgy code than DataTables but would welcome any ideas or comments

I can post screen shots and code if that helps

Many thanks
Phil

Replies

  • Phil HPhil H Posts: 20Questions: 0Answers: 0
    edited April 2010
    Hi Allan,

    Just had time to read a number of comments that relate to this issue. In my example it looks as if the number of columns in the header match the columns in the body and I have not specified aoColumns

    Here is the code

    The definition [code] '"bPaginate": false,"bLengthChange": false,"bInfo": true,"bFilter": false,"sPaginationType": "two_button", "bSort": false, "iDisplayLength": 100, "bAutoWidth": false' [/code]

    The header [code]

    Agent
    Off
    Daily
    Weekly
    Monthly
    Yearly
    Description
    Action


    [/code]

    The body [code]


    <?php
    $pname = $row['pname'];
    echo $pname ;
    echo "" ;
    ?>


    >


    >


    >


    >


    >


    <?php
    $pdesc = $row['pdesc'];
    echo $pdesc ;
    ?>



    <?php
    echo "Change" ;
    ?>




    [/code]

    A great product, many thanks Allan

    Phil
  • Phil HPhil H Posts: 20Questions: 0Answers: 0
    edited April 2010
    Hi Alan,

    I have been watching for an answer to my query and have not really found an answer as yet, I see that it is suggested to make sure that there are the right number of columns in the definition, but I have multiple tables of differing sizes in the same form

    I also get the same error message about the number of TD elements in the following situation. I have a form that has a DataTable towards the bottom, and have some links nearer the top ... if a link is clicked on before the table finishes loading you get the same error .. if the table finishes loading there is no error.

    Would it not be possible to write the message to the javascript error console rather than via a message box to the screen?.

    Can you tell me the last version number that does not have this error message please

    Thanks for a great product

    Phil
  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin
    Hi Phil,

    Sorry for the delay in getting back to you - I think the problem stems from the fact that you've got invalid HTML there - FROM cannot be a child of TR. If you pass it through the W3C validator, I think it will throw a wobbly :-). The browser might be doing something like adding TD nodes or something to try and 'correct' the tag soup - which is messing up DataTables, which expects valid HTML.

    As I recall this was introduced in 1.6.1 as part of the optimisations which went into that release (a huge performance benefit!). So if you really don't want that, try 1.6.0.

    Regarding your variable length tables - have a look at this post: http://datatables.net/forums/comments.php?DiscussionID=1486&page=1#Item_6 . It would be interesting to know if you think that change would help you out. Feel free to get in touch if you fancy taking an early 1.7 version for a spin.

    Regards,
    Allan
  • Phil HPhil H Posts: 20Questions: 0Answers: 0
    Hi Alan,

    Thanks for your comments, I moved the FORM statement outside the table and it works fine ... but would be grateful if you could answer the questions in the 2nd post

    1 .. If I have a form with two tables, one with 4 columns and with 6 how would I specify it ?. prior to 1.6.1 it did not really matter
    2 .. I have a form that has a DataTable towards the bottom, and have some links nearer the top ... if a link is clicked before the table finishes loading you get the counting error .. if the table finishes loading there is no error.This happens even if the columns definition is correct, is there a way around that ?
    3 .. Would it not be possible to write the message to the javascript error console rather than via a message box to the screen?. This is really not a message that the end user needs to see ?

    Many thanks
    Allan
  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin
    Hi Phil H,

    I could have sworn I wrote a reply to this a while back - sorry for the delay!

    1. You need to break it into two initialisation statements if you want to give it aoColumns. Or you could wait until 1.7 beta is released, which will introduce aoColumnDefs, whihc makes this kind of thing easier :-)

    2. This appears to be a bug in the web browsers... See the discussion here: http://datatables.net/forums/comments.php?DiscussionID=1885&page=1#Item_6

    3. Yes a console message would be good - but many developers would not see that message (many don't see JS errors!) so I took the approach of being brutal about this, since they should never actually occur for an end user. Your point number 2 however throws a real spanner into the works... Research ongoing.

    Regards,
    Allan
This discussion has been closed.