v3: Undocumented breaking change?
v3: Undocumented breaking change?
RichardD2
Posts: 31Questions: 2Answers: 1
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
- Switch the table to another page.
- Click "Redraw (old)" - notice nothing happens, and the page is not reset.
- Click "Redraw (new)" - the table is redrawn, and the page is reset to
1. - Click "Page info (old)" - notice that an error is logged to the console.
- 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. ![]()
Replies
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
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
Excellent! Thanks for the amazingly quick turnaround.