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

Commit 4238bb4

Browse files
committed
DataProp for promises #111
1 parent 3a35f23 commit 4238bb4

5 files changed

+18
-8
lines changed

dist/angular-datatables.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* angular-datatables - v0.2.1
2+
* angular-datatables - v0.3.0
33
* https://github.com/l-lin/angular-datatables
44
* License: MIT
55
*/
66
(function (window, document, $, angular) {
77
/*!
8-
* angular-datatables - v0.2.1
8+
* angular-datatables - v0.3.0
99
* https://github.com/l-lin/angular-datatables
1010
* License: MIT
1111
*/
@@ -1015,7 +1015,12 @@
10151015
renderer.name = 'DTPromiseRenderer';
10161016
renderer.options = options;
10171017
renderer.render = function ($scope, $elem) {
1018-
var _this = this, _loadedPromise = null, _whenLoaded = function (data) {
1018+
var _this = this, _loadedPromise = null, _whenLoaded = function (result) {
1019+
var data = result;
1020+
// In case the data is nested in an object
1021+
if (_this.options.sAjaxDataProp) {
1022+
data = result[_this.options.sAjaxDataProp];
1023+
}
10191024
_render(_this.options, $elem, data, $scope);
10201025
_loadedPromise = null;
10211026
}, _startLoading = function (fnPromise) {

dist/angular-datatables.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/datatables.bootstrap.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* angular-datatables - v0.2.1
2+
* angular-datatables - v0.3.0
33
* https://github.com/l-lin/angular-datatables
44
* License: MIT
55
*/

dist/datatables.bootstrap.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-datatables.renderer.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ angular.module('datatables.renderer', ['datatables.factory', 'datatables.options
143143
renderer.render = function ($scope, $elem) {
144144
var _this = this,
145145
_loadedPromise = null,
146-
_whenLoaded = function (data) {
146+
_whenLoaded = function (result) {
147+
var data = result;
148+
// In case the data is nested in an object
149+
if (_this.options.sAjaxDataProp) {
150+
data = result[_this.options.sAjaxDataProp];
151+
}
147152
_render(_this.options, $elem, data, $scope);
148153
_loadedPromise = null;
149154
}, _startLoading = function (fnPromise) {

0 commit comments

Comments
 (0)