-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose method to rerender entire directive #157
Comments
If you feel you can improve this module, by all means, I'll glady accept any proposition 😄 It seems your issue comes from the fact that you need to rerender your table. $scope.$on('event:dataTableLoaded', function(loadedDT) {
loadedDT.DataTable.draw(); // This will redraw your table
}); Not sure If I answer your question. |
Not exactly. What I could do with that is bind the $scope.$on('someevent', function() {
this.loadedDT.draw();
}); Or something of the sort. After trying that, however, it only seems to rerender part of the actual table (and that's after a significant timeout). There seems to be some disparity between the |
This feature will be available for the upcoming version (v0.4.0). <div ng-controller="MyCtrl as showCase">
<button ng-click="showCase.dtInstance.rerender">Re-render</button>
<table datatables dt-options="showCase.dtOptions" dt-columns="showCase.dtColumns"></table>
</div> angular.module('yourModule', ['datatables'])
.controller('MyCtrl', MyCtrl);
function MyCtrl(DTOptionsBuilder, DTColumnsBuilder, DTInstances) {
var vm = this;
vm.dtOptions = ...;
vm.dtColumns = [...];
DTInstances.getLast().then(function(dtInstance) {
vm.dtInstance = dtInstance;
});
} |
Does not appear to be working. The promise is never resolved. In the source it looks like the variable |
Can you provide a plnkr or something alike that reproduces the issue? I don't reproduce the error in my demo. |
I was trying to use the function ```DTOptionsBuilder.newOption().withFnServerData. I'm wanting to use this so I can pass additional data to the POST request. Is there another technique for doing that? Here's a plnkr |
You must have forgotten to save your changes on the plnkr. |
Here's the plunk. |
Well, |
It seems that there are services exposed by factories to render the individual components of the directive, but none that seem to take the same approach as the watcher in the compile function of the directive. It also seems like there is not an easy way to get the
buildOptions
and other vars to pass into the factory.I've seen some other libraries allowing you to pass in a control object to the directive and expose methods that way, any objections to me doing that?
The text was updated successfully, but these errors were encountered: