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

Emit event when datatable was created; That needed in other parent directives for example; #20

Merged
merged 1 commit into from
Jul 11, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/angular-datatables.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
$elem.show();
$loading.hide();
};
var _doRenderDataTable = function($elem, options) {
var _doRenderDataTable = function($elem, options, $scope) {
// Add $timeout to be sure that angular has finished rendering before calling datatables
$timeout(function() {
_hideLoading($elem);
$elem.DataTable(options);
$scope.$emit('event:dataTableLoaded', { id: $elem.attr('id') });
}, 0, false);
};

Expand Down Expand Up @@ -53,7 +54,7 @@
return {
options: options,
render: function ($scope, $elem) {
_doRenderDataTable($elem, this.options);
_doRenderDataTable($elem, this.options, $scope);
}
};
};
Expand All @@ -70,7 +71,7 @@
render: function ($scope, $elem) {
var _this = this;
$scope.$on(DT_LAST_ROW_KEY, function () {
_doRenderDataTable($elem, _this.options);
_doRenderDataTable($elem, _this.options, $scope);
});
}
};
Expand Down