deferLoading bugs?

deferLoading bugs?

jouvenjouven Posts: 22Questions: 1Answers: 0
edited October 2015 in Free community support

http://live.datatables.net/cuyemayu/1/edit

Assuming deferLoading by default is false --> https://datatables.net/reference/option/deferLoading
The problems:

1 Putting the false explicitly --> deferLoading: false doesn't do the load. Not writing the option at all loads fine.

2 Initializing the dataTables before adding it to the document.body and before any load has happened, so in both deferLoading: true or deferLoading: false, right now breaks the selection events.

Replies

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    Can you give a link to a version of the test case that shows the issue please. I followed the comments in the link but there is no data in the table on load so there are no events.

  • jouvenjouven Posts: 22Questions: 1Answers: 0

    Change the value in show entries drop and it will load data.

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    Got it - thanks.

    Okay, the issue is that Select listens for preInit - when that event is found to occur Select will add its events.

    However, it listens for that event on the document. That is a problem because your table hasn't yet been attached to the document. The deferLoading has no impact on this issue - it is purely because the table hasn't been inserted into the document.

    The next major release of DataTables is going to rework how the events work and I will try to address this issue as part of that work, but for the moment you need to have the table in the document before this will work.

    Regards,
    Allan

  • jouvenjouven Posts: 22Questions: 1Answers: 0

    The deferLoading has no impact on this issue - it is purely because the table hasn't been inserted into the document.

    Even when adding the table to the document first, still, deferLoading: false, and omitting the option should have the same effect (because false by default), still the two cases behave differently in the test case.

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    If I insert the table into the document first ( http://live.datatables.net/cuyemayu/10/edit ) then the deferRender option has no effect on the row selection - rows are always selectable one the page length menu has been changed.

    Allan

  • jouvenjouven Posts: 22Questions: 1Answers: 0
    edited November 2015

    I'm referring to the fact that datables loads the rows by default if no deferLoading option is set, but when it's set to false, which is the default value when not provided, it doesn't load any rows. Just comment the deferLoading: false, in the test case you provided and you'll see that it loads rows when it didn't before. It is to my understanding that both cases should have the same results.

    I checked the deferLoading documentation page again, it only shows information for integer and array arguments but then defines the default value as a boolean (false)... so I'm not sure anymore, I used to use this option to allow/not allow the initial load but it seems this isn't possible anymore or at least not in an intuitive way.

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    http://live.datatables.net/cuyemayu/17/edit - deferLoading commented out. Rows loaded as they should be (since there is no deferred loading). Rows can be selected, as the should be.

    I'm not sure I understand what the issue is there.

  • jouvenjouven Posts: 22Questions: 1Answers: 0
    edited November 2015

    Forget about the selection issue, I'm referring only to a deferLoading option issue.

    What value by default does deferLoading have when omitted? false, according to the documentation. But defining deferLoading option with a false value explicitly gives different results. Uncommenting the deferLoading line in your case should have the same effect as having it commented, if you try you should see that having it commented loads rows and having it uncommented doesn't load rows.

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    What value by default does deferLoading have when omitted? false, according to the documentation

    It should be null. Fix committed and will be deployed to the site soon.

    Thanks for letting me know about the documentation error.

    Allan

This discussion has been closed.