-
Notifications
You must be signed in to change notification settings - Fork 490
DTInstances.getList() nullpointerexception #232
Comments
There is a bug (check #198) in the v0.4.0. It has been fixed for the upcoming version. DTInstances.getList().then(function(dtInstances) {
/*
* This is the representation of dtInstances
* dtInstances === {
* "foobar": {"id": "foobar", "DataTable": oTable, "dataTable": $oTable},
* "foobar2": {"id": "foobar2", "DataTable": oTable, "dataTable": $oTable}
* }
*/
// Suppose you want to use the DataTables "reload()" API to the "foobar" table
// See https://datatables.net/reference/api/ajax.reload()
dtInstances.foobar.DataTable.reload();
// If you want to use the angular-datatables "reloadData()" api
// See http://l-lin.github.io/angular-datatables/#/dataReloadWithAjax
dtInstances.foobar.reloadData();
}); |
Hey l-lin, Thanks for the reply. I've added the extra lines as in #198, and changed my code to:
But now the code logger.info(...) never gets called. The getList() method gets called but that's it. I also tried it with the getLast() method, but that yields thesame result. |
See this pen. |
Hey l-lin, When I rewrite my code like the pen it also works, but I don't get why it doesn't in my example. I forked your pen to show my scenario. See this pen Anyway, I'll try to fetch all datatables instances at pageload and see if I can work with that. |
Mmh I didn't consider this use case. It's all about timing issue. For now, you will have to stick with calling like in my pen. 😞 |
Ok, thanks 😄 I've already made a beginning using the code you provided in your pen and it's looking good sofar. 👍 |
I have several datatables on a single page and I want to be able to filter the results on a date (date between this and that). I've made a custom filter for this and I want to include this in the request I make to the server when fetching the results. I use serverside processing by the way.
In order to do this I need to reload the data for all datatable instances whenever the user updates the date filter. I'm trying the following, but I get a nullpointerexception.
It seems the NPE occurs in the getList() method. Is this a known bug or have I messed something up? The datatables are already initialised when the method gets called.
The text was updated successfully, but these errors were encountered: