No data available in the table

No data available in the table

johnblythejohnblythe Posts: 92Questions: 21Answers: 2

hey alan,

happy new year! when using the fixedheader extension i'm finding some strange behavior.

when you scroll down far enough for the fixedheader to kick in and then refresh the page it shows the table of info and an empty table ('no data available') above it after scrolling back up to the top.

similarly, when doing different editing functions on the table they would get hung up with this error:

TypeError: Cannot read property 'style' of undefined

presumably about that empty table.

it seems as if when the fixedheader kicks in a new table is created in order to keep the header info up with the one being scrolled. so when DT api calls are made our code gets confused as to which is being referenced.

does this sound about right? what do you think the best way around it is? something more foundational than simply interjecting a find-the-right-datatable function before each api call?

thanks!

This question has an accepted answers - jump to answer

Answers

  • johnblythejohnblythe Posts: 92Questions: 21Answers: 2

    for some visual reference: http://imgur.com/tZi5BHS

  • allanallan Posts: 48,908Questions: 1Answers: 7,133 Site admin

    Are you able to link to a test page showing the issue please. Also, have you tried the nightly version?

    Thanks,
    Allan

  • johnblythejohnblythe Posts: 92Questions: 21Answers: 2

    I don't currently, but I can get one up today most likely. I'm a bit hesitant to not use the production-ready builds since it'll be in production for us w enterprise accounts and at the focal point of our value-add—literally can't operate w/o it functioning correctly.

  • johnblythejohnblythe Posts: 92Questions: 21Answers: 2

    Until I can get a test version up for you, here's a link to the debug info: http://debug.datatables.net/ehanuw

  • allanallan Posts: 48,908Questions: 1Answers: 7,133 Site admin

    Thanks - the test page would be great. PM me if you don't want to make the page public, by clicking my name above and then the "Send message" button.

    Allan

  • johnblythejohnblythe Posts: 92Questions: 21Answers: 2

    awesome, will do. likely this afternoon so you can have it in the a.m.

    thanks!

    best,

  • allanallan Posts: 48,908Questions: 1Answers: 7,133 Site admin
    Answer ✓

    Its being caused by this line:

    $("table").DataTable().rows().nodes().each(function() {

    That is selecting all table elements on the page and making them a DataTable. If it is already a DataTable, then it just gets the existing table, but if it isn't it is creating the table.

    When the FixedHeader it active, there are multiple tables - hence the issue.

    Might be best to use the window.dt variable that you assign rather than creating a new instance.

    Allan

  • johnblythejohnblythe Posts: 92Questions: 21Answers: 2

    Thanks, Allan!

This discussion has been closed.