≡

v3: Undocumented breaking change?

v3: Undocumented breaking change?

RichardD2RichardD2 Posts: 31Questions: 2Answers: 1
edited October 23 in Free community support

I am upgrading some code from DTv2 to v3. I have a lot of calls that use $(...).dataTable().api()..., which no longer seem to work. As far as I can see, this is not mentioned in the Upgrading to DataTables 3 document.

Examples:
* $("#example").dataTable().api().draw() does nothing;
* $("#example").dataTable().api().page.info() throws an exception: TypeError: can't access property "displayStart", settings is undefined

Demo: https://live.datatables.net/tozajeho/1/edit?js,console,output

  1. Switch the table to another page.
  2. Click "Redraw (old)" - notice nothing happens, and the page is not reset.
  3. Click "Redraw (new)" - the table is redrawn, and the page is reset to 1.
  4. Click "Page info (old)" - notice that an error is logged to the console.
  5. Click "Page info (new)" - notice the page info object is logged to the console.

NB: These are all fairly easy to correct in my code. But if $(...).dataTable().api() is no longer supported, that should be mentioned in the upgrade notes. And if it is supposed to be supported, then there is a bug with that support. :smile:

Replies

  • allanallan Posts: 66,144Questions: 1Answers: 11,028 Site admin

    Sounds like a bug I'm afraid. It should work and it should be in the unit tests. Sounds like something has gone wrong somewhere.

    I'll look into it and get back to you!

    Allan

  • allanallan Posts: 66,144Questions: 1Answers: 11,028 Site admin
    edited October 26

    That's the fix committed. The updated test case with the change works nicely now.

    The change will be in the next patch release, which I expect to release later this week.

    Allan

  • RichardD2RichardD2 Posts: 31Questions: 2Answers: 1

    Excellent! Thanks for the amazingly quick turnaround. :smiley:

Sign In or Register to comment.