ie issue dataTable ajax

ie issue dataTable ajax

lusitonlusiton Posts: 4Questions: 0Answers: 0
edited February 2011 in TableTools
Hello, my name is Gil. I'm using datatable plugin on one of the sites my company builds for a client. I run into a raise condition problem with ie 7-8. Here is the page that showcases the issue: http://aim.libertyconcepts.com/Legislative-Action-Center. On FF, Chrome page will load normally but ie gives a warning about "Unexpected number of TD elements". There is an ajax function "getXmlSenate()" in init.js that reads XML and then creates table dynamically and appends a row using fnOpen function. I would appreciate you help and assistance in solving this issue.

Replies

  • allanallan Posts: 54,882Questions: 1Answers: 8,601 Site admin
    I might be being a bit daft here, but I don't see where #example is defined. You've got the thead with:
    $j('#example').html('' + ths + '' + tbl);

    But the #example element isn't in the HTML or the Javascript that I can see. In Firefox I get an error about 'oTableSen is undefined'.

    Just after this line:
    $j('#example').html('' + ths + '' + tbl);

    could you include:
    console.log( $j('#example') );
    console.log( '' + ths + '' + tbl );

    Will hopefully help to see what is going on.

    Regards,
    Allan
  • lusitonlusiton Posts: 4Questions: 0Answers: 0
    Allan, Thank you for a quick response. I did comment out 'oTableSen' and completely forgot about it. I apologize for that. The table exists on the page in static html and I'm just adding more html to it. I also tried to bring
    '' into javascript so it will append the whole table at once to a div and still no luck. As you asked, I added console.log( $j('#example') );
    console.log( '' + ths + '' + tbl );.
  • allanallan Posts: 54,882Questions: 1Answers: 8,601 Site admin
    I think I am being daft now - I can't actually see any tables on the linked page. I see the DataTables include, but no initialisation or console messages. Do I need to do something to bring the tables up?

    Allan
  • lusitonlusiton Posts: 4Questions: 0Answers: 0
    Hey Allan. Thank you for your help. I actually found an error but the issue now the table is 800 rows long and I'm not sure if plugin can handle that and if it can, how could I apply fnOpen function to each.

    Currently I use this loop
    [code]
    for(i=0; i
  • lusitonlusiton Posts: 4Questions: 0Answers: 0
    Sorry one more thing, tbRow.length returns 10 but there are 800 rows total. May be there is a setting that I need to change so loop will append the row first and then create pagination. Thank you
  • allanallan Posts: 54,882Questions: 1Answers: 8,601 Site admin
    Good to hear you got the original issue fixed.

    The problem you are facing now is that your tbRow will be generated by querying the DOM, which has only the rows on the current page in it. The way DataTables works is that it will remove and insert rows from the DOM as required. To get all TR nodes, you can use the fnGetNodes ( http://datatables.net/api#fnGetNodes ) API function. Example use: http://datatables.net/examples/advanced_init/events_post_init.html

    Allan
This discussion has been closed.