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

Commit f4d4d45

Browse files
committed
Forgot to add select and buttons in dist #428
1 parent 864d754 commit f4d4d45

12 files changed

+212
-97
lines changed

dist/angular-datatables.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -972,10 +972,10 @@ function dtPromiseRenderer($q, $timeout, $log, DTRenderer, DTRendererService, DT
972972
throw new Error('You must provide a promise or a function that returns a promise!');
973973
}
974974
if (_loadedPromise) {
975-
_loadedPromise.then(function(){
975+
_loadedPromise.then(function()  {
976976
defer.resolve(_startLoading(fnPromise, callback));
977977
});
978-
} else {
978+
} else  {
979979
defer.resolve(_startLoading(fnPromise, callback));
980980
}
981981
return defer.promise;
@@ -1099,27 +1099,27 @@ function dtAjaxRenderer($q, $timeout, DTRenderer, DTRendererService, DT_DEFAULT_
10991099
}
11001100

11011101
function _doRender(options, $elem) {
1102-
var defer = $q.defer();
1103-
// Destroy the table if it exists in order to be able to redraw the dataTable
1104-
options.bDestroy = true;
1105-
if (_oTable) {
1106-
_oTable.destroy();
1107-
DTRendererService.showLoading(_$elem);
1108-
// Empty in case of columns change
1109-
$elem.empty();
1110-
}
1111-
DTRendererService.hideLoading($elem);
1112-
// Condition to refresh the dataTable
1113-
if (_shouldDeferRender(options)) {
1114-
$timeout(function() {
1102+
var defer = $q.defer();
1103+
// Destroy the table if it exists in order to be able to redraw the dataTable
1104+
options.bDestroy = true;
1105+
if (_oTable) {
1106+
_oTable.destroy();
1107+
DTRendererService.showLoading(_$elem);
1108+
// Empty in case of columns change
1109+
$elem.empty();
1110+
}
1111+
DTRendererService.hideLoading($elem);
1112+
// Condition to refresh the dataTable
1113+
if (_shouldDeferRender(options)) {
1114+
$timeout(function() {
1115+
defer.resolve(DTRendererService.renderDataTable($elem, options));
1116+
}, 0, false);
1117+
} else {
11151118
defer.resolve(DTRendererService.renderDataTable($elem, options));
1116-
}, 0, false);
1117-
} else {
1118-
defer.resolve(DTRendererService.renderDataTable($elem, options));
1119+
}
1120+
return defer.promise;
11191121
}
1120-
return defer.promise;
1121-
}
1122-
// See https://github.com/l-lin/angular-datatables/issues/147
1122+
// See https://github.com/l-lin/angular-datatables/issues/147
11231123
function _shouldDeferRender(options) {
11241124
if (angular.isDefined(options) && angular.isDefined(options.dom)) {
11251125
// S for scroller plugin
@@ -1137,7 +1137,7 @@ function dtRendererFactory(DTDefaultRenderer, DTNGRenderer, DTPromiseRenderer, D
11371137
fromOptions: fromOptions
11381138
};
11391139

1140-
function fromOptions(options, isNgDisplay){
1140+
function fromOptions(options, isNgDisplay)  {
11411141
if (isNgDisplay) {
11421142
if (options && options.serverSide) {
11431143
throw new Error('You cannot use server side processing along with the Angular renderer!');
@@ -1284,4 +1284,4 @@ function dtPropertyUtil($q) {
12841284
dtPropertyUtil.$inject = ['$q'];
12851285

12861286

1287-
})(window, document, jQuery, angular);
1287+
})(window, document, jQuery, angular);

dist/plugins/bootstrap/angular-datatables.bootstrap.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ dtBootstrapColVis.$inject = ['DTPropertyUtil', 'DTBootstrapDefaultOptions'];
4747

4848
// See http://getbootstrap.com
4949
angular.module('datatables.bootstrap', [
50-
'datatables.bootstrap.options',
51-
'datatables.bootstrap.tabletools',
52-
'datatables.bootstrap.colvis'
53-
])
50+
'datatables.bootstrap.options',
51+
'datatables.bootstrap.tabletools',
52+
'datatables.bootstrap.colvis'
53+
])
5454
.config(dtBootstrapConfig)
5555
.run(initBootstrapPlugin)
5656
.service('DTBootstrap', dtBootstrap);
@@ -283,14 +283,14 @@ function dtBootstrap(DTBootstrapTableTools, DTBootstrapColVis, DTBootstrapDefaul
283283
if (btnDisplay) {
284284
$paginationBtn.appendTo($paginationContainer);
285285
node = $('<a>', {
286-
'href': '#',
287-
'class': btnClass,
288-
'aria-controls': settings.sTableId,
289-
'data-dt-idx': counter,
290-
'tabindex': settings.iTabIndex,
291-
'id': idx === 0 && typeof button === 'string' ?
292-
settings.sTableId + '_' + button : null
293-
})
286+
'href': '#',
287+
'class': btnClass,
288+
'aria-controls': settings.sTableId,
289+
'data-dt-idx': counter,
290+
'tabindex': settings.iTabIndex,
291+
'id': idx === 0 && typeof button === 'string' ?
292+
settings.sTableId + '_' + button : null
293+
})
294294
.html(btnDisplay)
295295
.appendTo($paginationBtn);
296296

@@ -354,15 +354,15 @@ function dtBootstrap(DTBootstrapTableTools, DTBootstrapColVis, DTBootstrapDefaul
354354
}
355355

356356
function _setDom(options) {
357-
if (!options.dom || options.dom === DT_DEFAULT_OPTIONS.dom) {
358-
return DTBootstrapDefaultOptions.getOptions().dom;
357+
if (!options.dom || options.dom === DT_DEFAULT_OPTIONS.dom) {
358+
return DTBootstrapDefaultOptions.getOptions().dom;
359+
}
360+
return options.dom;
359361
}
360-
return options.dom;
361-
}
362-
/**
363-
* Integrate Bootstrap
364-
* @param options the datatables options
365-
*/
362+
/**
363+
* Integrate Bootstrap
364+
* @param options the datatables options
365+
*/
366366
function integrate(options) {
367367
_init(options.bootstrap);
368368
DTBootstrapTableTools.integrate(options.bootstrap);

dist/plugins/buttons/angular-datatables.buttons.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,62 @@
33
* https://github.com/l-lin/angular-datatables
44
* License: MIT
55
*/
6+
(function (window, document, $, angular) {
7+
8+
'use strict';
9+
10+
// See https://datatables.net/extensions/buttons/
11+
angular.module('datatables.buttons', ['datatables'])
12+
.config(dtButtonsConfig);
13+
14+
/* @ngInject */
15+
function dtButtonsConfig($provide, DT_DEFAULT_OPTIONS) {
16+
$provide.decorator('DTOptionsBuilder', dtOptionsBuilderDecorator);
17+
18+
function dtOptionsBuilderDecorator($delegate) {
19+
var newOptions = $delegate.newOptions;
20+
var fromSource = $delegate.fromSource;
21+
var fromFnPromise = $delegate.fromFnPromise;
22+
23+
$delegate.newOptions = function() {
24+
return _decorateOptions(newOptions);
25+
};
26+
$delegate.fromSource = function(ajax) {
27+
return _decorateOptions(fromSource, ajax);
28+
};
29+
$delegate.fromFnPromise = function(fnPromise) {
30+
return _decorateOptions(fromFnPromise, fnPromise);
31+
};
32+
33+
return $delegate;
34+
35+
function _decorateOptions(fn, params) {
36+
var options = fn(params);
37+
options.withButtons = withButtons;
38+
return options;
39+
40+
/**
41+
* Add buttons compatibility
42+
* @param buttonsOptions the options of the buttons extension (see https://datatables.net/reference/option/buttons#Examples)
43+
* @returns {DTOptions} the options
44+
*/
45+
function withButtons(buttonsOptions) {
46+
var buttonsPrefix = 'B';
47+
options.dom = options.dom ? options.dom : DT_DEFAULT_OPTIONS.dom;
48+
if (options.dom.indexOf(buttonsPrefix) === -1) {
49+
options.dom = buttonsPrefix + options.dom;
50+
}
51+
if (angular.isUndefined(buttonsOptions)) {
52+
throw new Error('You must define the options for the button extension. See https://datatables.net/reference/option/buttons#Examples for some example');
53+
}
54+
options.buttons = buttonsOptions;
55+
return options;
56+
}
57+
}
58+
}
59+
dtOptionsBuilderDecorator.$inject = ['$delegate'];
60+
}
61+
dtButtonsConfig.$inject = ['$provide', 'DT_DEFAULT_OPTIONS'];
62+
63+
64+
})(window, document, jQuery, angular);

dist/plugins/buttons/angular-datatables.buttons.min.js

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

dist/plugins/buttons/angular-datatables.select.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

dist/plugins/buttons/angular-datatables.select.min.js

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*!
2+
* angular-datatables - v0.5.1
3+
* https://github.com/l-lin/angular-datatables
4+
* License: MIT
5+
*/
6+
(function (window, document, $, angular) {
7+
8+
'use strict';
9+
10+
// See https://datatables.net/extensions/select/
11+
angular.module('datatables.select', ['datatables'])
12+
.config(dtSelectConfig);
13+
14+
/* @ngInject */
15+
function dtSelectConfig($provide) {
16+
$provide.decorator('DTOptionsBuilder', dtOptionsBuilderDecorator);
17+
18+
function dtOptionsBuilderDecorator($delegate) {
19+
var newOptions = $delegate.newOptions;
20+
var fromSource = $delegate.fromSource;
21+
var fromFnPromise = $delegate.fromFnPromise;
22+
23+
$delegate.newOptions = function() {
24+
return _decorateOptions(newOptions);
25+
};
26+
$delegate.fromSource = function(ajax) {
27+
return _decorateOptions(fromSource, ajax);
28+
};
29+
$delegate.fromFnPromise = function(fnPromise) {
30+
return _decorateOptions(fromFnPromise, fnPromise);
31+
};
32+
33+
return $delegate;
34+
35+
function _decorateOptions(fn, params) {
36+
var options = fn(params);
37+
options.withSelect = withSelect;
38+
return options;
39+
40+
/**
41+
* Add select compatibility
42+
* @param selectOptions the options of the select extension (see https://datatables.net/reference/option/#select)
43+
* @returns {DTOptions} the options
44+
*/
45+
function withSelect(selectOptions) {
46+
if (angular.isUndefined(selectOptions)) {
47+
throw new Error('You must define the options for the select extension. See https://datatables.net/reference/option/#select');
48+
}
49+
options.select = selectOptions;
50+
return options;
51+
}
52+
}
53+
}
54+
dtOptionsBuilderDecorator.$inject = ['$delegate'];
55+
}
56+
dtSelectConfig.$inject = ['$provide'];
57+
58+
59+
})(window, document, jQuery, angular);

dist/plugins/select/angular-datatables.select.min.js

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

grunt/concat.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
'<%= yeoman.build %>/plugins/fixedcolumns/angular-datatables.fixedcolumns.js': ['<%= yeoman.src %>/plugins/fixedcolumns/*.js'],
2121
'<%= yeoman.build %>/plugins/fixedheader/angular-datatables.fixedheader.js': ['<%= yeoman.src %>/plugins/fixedheader/*.js'],
2222
'<%= yeoman.build %>/plugins/buttons/angular-datatables.buttons.js': ['<%= yeoman.src %>/plugins/buttons/*.js'],
23-
'<%= yeoman.build %>/plugins/buttons/angular-datatables.select.js': ['<%= yeoman.src %>/plugins/select/*.js']
23+
'<%= yeoman.build %>/plugins/select/angular-datatables.select.js': ['<%= yeoman.src %>/plugins/select/*.js']
2424
}
2525
},
2626
// Copy the source files with the banner in dist folder
@@ -36,8 +36,8 @@ module.exports = {
3636
'<%= yeoman.dist %>/plugins/tabletools/angular-datatables.tabletools.js': ['<%= yeoman.build %>/plugins/tabletools/angular-datatables.tabletools.js'],
3737
'<%= yeoman.dist %>/plugins/fixedcolumns/angular-datatables.fixedcolumns.js': ['<%= yeoman.build %>/plugins/fixedcolumns/angular-datatables.fixedcolumns.js'],
3838
'<%= yeoman.dist %>/plugins/fixedheader/angular-datatables.fixedheader.js': ['<%= yeoman.build %>/plugins/fixedheader/angular-datatables.fixedheader.js'],
39-
'<%= yeoman.dist %>/plugins/buttons/angular-datatables.buttons.js': ['<%= yeoman.build %>/plugins/fixedheader/angular-datatables.buttons.js'],
40-
'<%= yeoman.dist %>/plugins/buttons/angular-datatables.select.js': ['<%= yeoman.build %>/plugins/fixedheader/angular-datatables.select.js']
39+
'<%= yeoman.dist %>/plugins/buttons/angular-datatables.buttons.js': ['<%= yeoman.build %>/plugins/buttons/angular-datatables.buttons.js'],
40+
'<%= yeoman.dist %>/plugins/select/angular-datatables.select.js': ['<%= yeoman.build %>/plugins/select/angular-datatables.select.js']
4141
}
4242
},
4343
bannerCSS: {

grunt/ngAnnotate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ module.exports = {
1515
'<%= yeoman.build %>/plugins/tabletools/angular-datatables.tabletools.js': ['<%= yeoman.build %>/plugins/tabletools/angular-datatables.tabletools.js'],
1616
'<%= yeoman.build %>/plugins/fixedcolumns/angular-datatables.fixedcolumns.js': ['<%= yeoman.build %>/plugins/fixedcolumns/angular-datatables.fixedcolumns.js'],
1717
'<%= yeoman.build %>/plugins/fixedheader/angular-datatables.fixedheader.js': ['<%= yeoman.build %>/plugins/fixedheader/angular-datatables.fixedheader.js'],
18-
'<%= yeoman.build %>/plugins/buttons/angular-datatables.buttons.js': ['<%= yeoman.build %>/plugins/fixedheader/angular-datatables.buttons.js'],
19-
'<%= yeoman.build %>/plugins/buttons/angular-datatables.select.js': ['<%= yeoman.build %>/plugins/fixedheader/angular-datatables.select.js']
18+
'<%= yeoman.build %>/plugins/buttons/angular-datatables.buttons.js': ['<%= yeoman.build %>/plugins/buttons/angular-datatables.buttons.js'],
19+
'<%= yeoman.build %>/plugins/select/angular-datatables.select.js': ['<%= yeoman.build %>/plugins/select/angular-datatables.select.js']
2020
}
2121
}
2222
};

src/angular-datatables.renderer.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -430,27 +430,27 @@ function dtAjaxRenderer($q, $timeout, DTRenderer, DTRendererService, DT_DEFAULT_
430430
}
431431

432432
function _doRender(options, $elem) {
433-
var defer = $q.defer();
434-
// Destroy the table if it exists in order to be able to redraw the dataTable
435-
options.bDestroy = true;
436-
if (_oTable) {
437-
_oTable.destroy();
438-
DTRendererService.showLoading(_$elem);
439-
// Empty in case of columns change
440-
$elem.empty();
441-
}
442-
DTRendererService.hideLoading($elem);
443-
// Condition to refresh the dataTable
444-
if (_shouldDeferRender(options)) {
445-
$timeout(function() {
433+
var defer = $q.defer();
434+
// Destroy the table if it exists in order to be able to redraw the dataTable
435+
options.bDestroy = true;
436+
if (_oTable) {
437+
_oTable.destroy();
438+
DTRendererService.showLoading(_$elem);
439+
// Empty in case of columns change
440+
$elem.empty();
441+
}
442+
DTRendererService.hideLoading($elem);
443+
// Condition to refresh the dataTable
444+
if (_shouldDeferRender(options)) {
445+
$timeout(function() {
446+
defer.resolve(DTRendererService.renderDataTable($elem, options));
447+
}, 0, false);
448+
} else {
446449
defer.resolve(DTRendererService.renderDataTable($elem, options));
447-
}, 0, false);
448-
} else {
449-
defer.resolve(DTRendererService.renderDataTable($elem, options));
450+
}
451+
return defer.promise;
450452
}
451-
return defer.promise;
452-
}
453-
// See https://github.com/l-lin/angular-datatables/issues/147
453+
// See https://github.com/l-lin/angular-datatables/issues/147
454454
function _shouldDeferRender(options) {
455455
if (angular.isDefined(options) && angular.isDefined(options.dom)) {
456456
// S for scroller plugin

0 commit comments

Comments
 (0)