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

Commit bc0916b

Browse files
committed
Update README.md
1 parent f11f15c commit bc0916b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,29 @@ $scope.$on('event:dataTableLoaded', function(event, loadedDT) {
9696
* `Angular Datatables` is using [Object.create()](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Object/create) to instanciate options and columns.
9797
* If you need to support IE8, then you need to add this [Polyfill](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill).
9898

99+
* When providing the DT options, `Angular DataTables` will resolve every promises (except the attributes `data` and `aaData`) before rendering the DataTable.
100+
101+
For example, suppose we provide the following code:
102+
103+
```html
104+
angular.module('yourModule')
105+
.controller('MyCtrl', MyCtrl);
106+
107+
function MyCtrl($q, DTOptionsBuilder) {
108+
var vm = this;
109+
vm.dtOptions = DTOptionBuilder.newOptions()
110+
.withOptions('autoWidth', fnThatReturnsAPromise);
111+
112+
function fnThatReturnsAPromise() {
113+
var defer = $q.defer();
114+
defer.resolve(false);
115+
return defer.promise;
116+
}
117+
}
118+
```
119+
120+
The `fnThatReturnsAPromise` will first be resolved and then the DataTable will be rendered with the option `autoWidth` set to `false`.
121+
99122
Contributing
100123
============
101124

0 commit comments

Comments
 (0)