-
Notifications
You must be signed in to change notification settings - Fork 490
Add the possibility to provide an object or a callback function to fetch the DT instance #307
Comments
Sorry as i'm not familiar with github, where can i find the new code version containing this bug fix ? Big thanks! |
Forget my comment i found the new code thx |
I found this thread when I ran into this issue trying to include multiple DataTables on one page. I followed your advice regarding adding the dt-instance attribute to my table, but it did not fix the problem for me. After some digging through the code I found out why it wasn't working for me: I'm using the Ajax Renderer rather than the Angular Renderer and your fix was only applied to the Angular Renderer. I replicated the changes in the Ajax Renderer and it now works fine for me. Original code (line 1162 in angular-datatables.js v0.4.3): function rerender() {
_oTable.destroy();
DTRendererService.showLoading(_$elem);
render(_$elem);
} Modified code: function rerender() {
_oTable.ngDestroy();
DTRendererService.showLoading(_$elem);
$timeout(function() {
var result = DTRendererService.hideLoadingAndRenderDataTable(_$elem, renderer.options);
_oTable = result.DataTable;
dtInstance = DTInstances.register(dtInstance, result);
}, 0, false);
} |
It should work even with the Ajax renderer. See this example. |
Thankfully l-lin!... Sincerely. |
I followed lin's code and trying to use
I've got this warning and the data is not reloaded.
|
Instead of using
DTInstances
service (which caused more headaches than expected 😞 ), one solution is to create another directivedt-instance
in which it will be possible to provide a variable that angular-datatables will populate with the DT directive instance.One example:
The user should also have the possibility to set a callback function instead of a variable:
Note: This enhancement will completely replace the
DTInstances
service. So expect the removal of theDTInstances
service in the v0.5.0+ versions!!!The text was updated successfully, but these errors were encountered: