Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit f676868

Browse files
committed
Emit event when datatable was created; That needed in other parent directives for example;
1 parent c3f21cb commit f676868

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/angular-datatables.directive.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
$elem.show();
1717
$loading.hide();
1818
};
19-
var _doRenderDataTable = function($elem, options) {
19+
var _doRenderDataTable = function($elem, options, $scope) {
2020
// Add $timeout to be sure that angular has finished rendering before calling datatables
2121
$timeout(function() {
2222
_hideLoading($elem);
2323
$elem.DataTable(options);
24+
$scope.$emit('event:dataTableLoaded', { id: $elem.attr('id') });
2425
}, 0, false);
2526
};
2627

@@ -53,7 +54,7 @@
5354
return {
5455
options: options,
5556
render: function ($scope, $elem) {
56-
_doRenderDataTable($elem, this.options);
57+
_doRenderDataTable($elem, this.options, $scope);
5758
}
5859
};
5960
};
@@ -70,7 +71,7 @@
7071
render: function ($scope, $elem) {
7172
var _this = this;
7273
$scope.$on(DT_LAST_ROW_KEY, function () {
73-
_doRenderDataTable($elem, _this.options);
74+
_doRenderDataTable($elem, _this.options, $scope);
7475
});
7576
}
7677
};

0 commit comments

Comments
 (0)