diff --git a/README.md b/README.md
index 7fbe4cc..dc2d9bc 100644
--- a/README.md
+++ b/README.md
@@ -56,13 +56,13 @@ docs coming soon, in the meantime, 'View Source' is your friend ;)!
#### Include
-You've got 5 different options to include this in your build depending on your setup.
+You've got 4 different options to include this in your build depending on your setup.
- `./release/dataTable.js` - A standalone file that was compiled with Babel (UMD)
- `./release/dataTable.min.js` - A minified standalone file that was compiled with Babel (UMD)
- `./release/dataTable.cjs.js` - A standalone file that was compiled with Babel (CommonJS)
- `./release/dataTable.es6.js` - Raw ES6 Version.
-
+
All distributions include babel helpers, so they do not have to be included separately.
There is also the CSS too:
diff --git a/bower.json b/bower.json
index 679a219..a039bb0 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "angular-data-table",
- "version": "0.7.0",
+ "version": "0.7.1",
"homepage": "https://github.com/Swimlane/angular-data-table",
"author": {
"name": "Swimlane",
diff --git a/config.js b/config.js
index 961df0f..a60c69a 100644
--- a/config.js
+++ b/config.js
@@ -14,23 +14,72 @@ System.config({
},
map: {
- "angular": "npm:angular@1.4.0",
- "babel": "npm:babel-core@5.8.22",
- "babel-runtime": "npm:babel-runtime@5.8.20",
- "core-js": "npm:core-js@1.1.1",
- "github:jspm/nodelibs-process@0.1.1": {
- "process": "npm:process@0.10.1"
+ "angular": "npm:angular@1.5.0",
+ "babel": "npm:babel-core@5.8.38",
+ "babel-runtime": "npm:babel-runtime@5.8.38",
+ "core-js": "npm:core-js@1.2.7",
+ "lodash-es": "npm:lodash-es@4.16.4",
+ "github:jspm/nodelibs-assert@0.1.0": {
+ "assert": "npm:assert@1.4.1"
},
- "npm:angular@1.4.0": {
- "process": "github:jspm/nodelibs-process@0.1.1"
+ "github:jspm/nodelibs-buffer@0.1.0": {
+ "buffer": "npm:buffer@3.6.0"
},
- "npm:babel-runtime@5.8.20": {
- "process": "github:jspm/nodelibs-process@0.1.1"
+ "github:jspm/nodelibs-path@0.1.0": {
+ "path-browserify": "npm:path-browserify@0.0.0"
},
- "npm:core-js@1.1.1": {
+ "github:jspm/nodelibs-process@0.1.2": {
+ "process": "npm:process@0.11.9"
+ },
+ "github:jspm/nodelibs-util@0.1.0": {
+ "util": "npm:util@0.10.3"
+ },
+ "github:jspm/nodelibs-vm@0.1.0": {
+ "vm-browserify": "npm:vm-browserify@0.0.4"
+ },
+ "npm:angular@1.5.0": {
+ "process": "github:jspm/nodelibs-process@0.1.2"
+ },
+ "npm:assert@1.4.1": {
+ "assert": "github:jspm/nodelibs-assert@0.1.0",
+ "buffer": "github:jspm/nodelibs-buffer@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.2",
+ "util": "npm:util@0.10.3"
+ },
+ "npm:babel-runtime@5.8.38": {
+ "process": "github:jspm/nodelibs-process@0.1.2"
+ },
+ "npm:buffer@3.6.0": {
+ "base64-js": "npm:base64-js@0.0.8",
+ "child_process": "github:jspm/nodelibs-child_process@0.1.0",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "ieee754": "npm:ieee754@1.1.8",
+ "isarray": "npm:isarray@1.0.0",
+ "process": "github:jspm/nodelibs-process@0.1.2"
+ },
+ "npm:core-js@1.2.7": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
- "process": "github:jspm/nodelibs-process@0.1.1",
- "systemjs-json": "github:systemjs/plugin-json@0.1.0"
+ "path": "github:jspm/nodelibs-path@0.1.0",
+ "process": "github:jspm/nodelibs-process@0.1.2",
+ "systemjs-json": "github:systemjs/plugin-json@0.1.2"
+ },
+ "npm:inherits@2.0.1": {
+ "util": "github:jspm/nodelibs-util@0.1.0"
+ },
+ "npm:path-browserify@0.0.0": {
+ "process": "github:jspm/nodelibs-process@0.1.2"
+ },
+ "npm:process@0.11.9": {
+ "assert": "github:jspm/nodelibs-assert@0.1.0",
+ "fs": "github:jspm/nodelibs-fs@0.1.2",
+ "vm": "github:jspm/nodelibs-vm@0.1.0"
+ },
+ "npm:util@0.10.3": {
+ "inherits": "npm:inherits@2.0.1",
+ "process": "github:jspm/nodelibs-process@0.1.2"
+ },
+ "npm:vm-browserify@0.0.4": {
+ "indexof": "npm:indexof@0.0.1"
}
}
});
diff --git a/package.json b/package.json
index 36f2548..e088ea5 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "angular-data-table",
"title": "AngularJS Data-Table",
"description": "A feature-rich but lightweight ES6 AngularJS Data Table crafted for large data sets!",
- "version": "0.7.0",
+ "version": "0.7.1",
"repository": {
"type": "git",
"url": "git@github.com:Swimlane/angular-data-table.git",
@@ -21,10 +21,16 @@
"url": "http://opensource.org/licenses/mit-license.php"
}
],
+ "scripts": {
+ "start": "node ./node_modules/gulp/bin/gulp.js watch serve",
+ "release": "node ./node_modules/gulp/bin/gulp.js release"
+ },
+ "peerDependencies": {
+ "angular": "1.5.x"
+ },
"devDependencies": {
- "angular": "^1.4.4",
- "angular-mocks": "^1.4.3",
- "babelify": "7.3.0",
+ "angular": "^1.5.0",
+ "angular-mocks": "^1.5.0",
"babel-core": "^6.9.0",
"babel-eslint": "^6.0.2",
"babel-plugin-external-helpers": "^6.5.0",
@@ -33,6 +39,7 @@
"babel-plugin-transform-es2015-modules-umd": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
+ "babelify": "7.3.0",
"browser-sync": "^2.7.2",
"chai-as-promised": "^5.3.0",
"del": "^1.2.0",
@@ -68,12 +75,12 @@
},
"jspm": {
"dependencies": {
- "angular": "npm:angular@^1.4.0"
+ "angular": "npm:angular@^1.5.0"
},
"devDependencies": {
- "babel": "npm:babel-core@^5.8.22",
- "babel-runtime": "npm:babel-runtime@^5.6.4",
- "core-js": "npm:core-js@^1.1.1"
+ "babel": "npm:babel-core@^5.8.24",
+ "babel-runtime": "npm:babel-runtime@^5.8.24",
+ "core-js": "npm:core-js@^1.1.4"
}
},
"babel": {
diff --git a/release/dataTable.cjs.js b/release/dataTable.cjs.js
index cb34ff8..0b7d82c 100644
--- a/release/dataTable.cjs.js
+++ b/release/dataTable.cjs.js
@@ -1,6 +1,6 @@
/**
* angular-data-table - A feature-rich but lightweight ES6 AngularJS Data Table crafted for large data sets!
- * @version v0.7.0
+ * @version v0.7.1
* @link http://swimlane.com/
* @license
*/
@@ -957,7 +957,7 @@ var BodyController = function () {
}, {
key: "calculateDepth",
value: function calculateDepth(row) {
- var depth = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
+ var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var parentProp = this.treeColumn ? this.treeColumn.relationProp : this.groupColumn.prop;
var prop = this.treeColumn.prop;
@@ -1304,8 +1304,19 @@ function NextSortDirection(sortType, currentSort) {
}
var HeaderCellController = function () {
- function HeaderCellController() {
+ HeaderCellController.$inject = ["$scope"];
+ function HeaderCellController($scope) {
_classCallCheck(this, HeaderCellController);
+
+ this.$scope = $scope;
+
+ if (this.$scope.$parent.$parent.$parent.$parent.dt) {
+ this.dt = this.$scope.$parent.$parent.$parent.$parent.dt;
+ }
+
+ if (this.column.headerCheckbox) {
+ this.column.headerCheckboxCallback = this.rowSelected;
+ }
}
_createClass(HeaderCellController, [{
@@ -1365,9 +1376,14 @@ var HeaderCellController = function () {
});
}
}, {
- key: "onCheckboxChange",
- value: function onCheckboxChange() {
- this.onCheckboxChanged();
+ key: "rowSelected",
+ value: function rowSelected(dt) {
+ this.allRowsSelected = dt.selected && dt.rows.length === dt.selected.length;
+ }
+ }, {
+ key: "checkboxChangeCallback",
+ value: function checkboxChangeCallback() {
+ return this.isAllRowsSelected = this.column.allRowsSelected ? this.dt.selectAllRows() : this.dt.deselectAllRows();
}
}]);
@@ -1383,14 +1399,13 @@ function HeaderCellDirective($compile) {
bindToController: {
options: '=',
column: '=',
- onCheckboxChange: '&',
onSort: '&',
sortType: '=',
onResize: '&',
selected: '='
},
replace: true,
- template: "
",
+ template: "",
compile: function compile() {
return {
pre: function pre($scope, $elm, $attrs, ctrl) {
@@ -1476,11 +1491,6 @@ var HeaderController = function () {
return styles;
}
- }, {
- key: "onCheckboxChanged",
- value: function onCheckboxChanged() {
- this.onCheckboxChange();
- }
}, {
key: "onResized",
value: function onResized(column, width) {
@@ -1504,11 +1514,12 @@ function HeaderDirective($timeout) {
options: '=',
columns: '=',
columnWidths: '=',
+ selectedRows: '=?',
+ allRows: '=',
onSort: '&',
- onResize: '&',
- onCheckboxChange: '&'
+ onResize: '&'
},
- template: "\n ",
+ template: "\n ",
replace: true,
link: function link($scope, $elm, $attrs, ctrl) {
@@ -2057,12 +2068,13 @@ var TableDefaults = {
};
var DataTableController = function () {
- DataTableController.$inject = ["$scope", "$filter", "$log", "$transclude"];
- function DataTableController($scope, $filter, $log, $transclude) {
+ DataTableController.$inject = ["$scope", "$filter", "$log", "$transclude", "$window"];
+ function DataTableController($scope, $filter, $log, $transclude, $window) {
var _this6 = this;
_classCallCheck(this, DataTableController);
+ $window.dt = this;
Object.assign(this, {
$scope: $scope,
$filter: $filter,
@@ -2108,6 +2120,14 @@ var DataTableController = function () {
if (this.options.selectable && this.options.multiSelect) {
this.selected = this.selected || [];
+
+ this.$scope.$watch('dt.selected', function (newVal, oldVal) {
+ angular.forEach(_this7.options.columns, function (column) {
+ if (column.headerCheckbox && angular.isFunction(column.headerCheckboxCallback)) {
+ column.headerCheckboxCallback(_this7);
+ }
+ });
+ }, true);
}
}
}, {
@@ -2241,24 +2261,27 @@ var DataTableController = function () {
this.options.internal.setYOffset(offsetY);
}
}, {
- key: "onHeaderCheckboxChange",
- value: function onHeaderCheckboxChange() {
- if (this.rows) {
- var matches = this.selected.length === this.rows.length;
- this.selected.splice(0, this.selected.length);
+ key: "selectAllRows",
+ value: function selectAllRows() {
+ var _selected;
- if (!matches) {
- var _selected;
+ this.selected.splice(0, this.selected.length);
- (_selected = this.selected).push.apply(_selected, _toConsumableArray(this.rows));
- }
- }
+ (_selected = this.selected).push.apply(_selected, _toConsumableArray(this.rows));
+
+ return this.isAllRowsSelected();
+ }
+ }, {
+ key: "deselectAllRows",
+ value: function deselectAllRows() {
+ this.selected.splice(0, this.selected.length);
+
+ return this.isAllRowsSelected();
}
}, {
key: "isAllRowsSelected",
value: function isAllRowsSelected() {
- if (this.rows) return false;
- return this.selected.length === this.rows.length;
+ return !this.rows || !this.selected ? false : this.selected.length === this.rows.length;
}
}, {
key: "onResized",
@@ -2331,7 +2354,7 @@ function DataTableDirective($window, $timeout, $parse) {
id = ObjectId();
DataTableService.saveColumns(id, columns);
- return "\n \n \n \n \n \n \n
";
+ return "\n \n \n \n \n \n \n
";
},
compile: function compile(tElem, tAttrs) {
return {
diff --git a/release/dataTable.es6.js b/release/dataTable.es6.js
index 3a3f3b9..be35fbf 100644
--- a/release/dataTable.es6.js
+++ b/release/dataTable.es6.js
@@ -1632,6 +1632,17 @@ function NextSortDirection(sortType, currentSort) {
}
class HeaderCellController{
+ constructor($scope){
+ this.$scope = $scope;
+
+ if (this.$scope.$parent.$parent.$parent.$parent.dt) {
+ this.dt = this.$scope.$parent.$parent.$parent.$parent.dt;
+ }
+
+ if (this.column.headerCheckbox) {
+ this.column.headerCheckboxCallback = this.rowSelected;
+ }
+ }
/**
* Calculates the styles for the header cell directive
* @return {styles}
@@ -1701,13 +1712,18 @@ class HeaderCellController{
});
}
+ rowSelected(dt){
+ this.allRowsSelected = (dt.selected) && (dt.rows.length === dt.selected.length);
+ }
+
/**
- * Invoked when the header cell directive checkbox was changed
+ * Invoked when the header cell directive checkbox is changed
*/
- onCheckboxChange(){
- this.onCheckboxChanged();
+ checkboxChangeCallback(){
+ return this.isAllRowsSelected = this.column.allRowsSelected ?
+ this.dt.selectAllRows() :
+ this.dt.deselectAllRows();
}
-
}
function HeaderCellDirective($compile){
@@ -1719,7 +1735,6 @@ function HeaderCellDirective($compile){
bindToController: {
options: '=',
column: '=',
- onCheckboxChange: '&',
onSort: '&',
sortType: '=',
onResize: '&',
@@ -1739,8 +1754,8 @@ function HeaderCellDirective($compile){
max-width="hcell.column.maxWidth">
'),c=o.parent();a.on("mousedown",function(t){return!!o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",r),void e.on("mouseup",s))}),o.append(a)}}}function b(e,t,n){var o,i,r,s=null,l=0;n||(n={});var a=function(){l=n.leading===!1?0:new Date,s=null,r=e.apply(o,i)};return function(){var c=new Date;l||n.leading!==!1||(l=c);var d=t-(c-l);return o=this,i=arguments,d<=0?(clearTimeout(s),s=null,l=c,r=e.apply(o,i)):s||n.trailing===!1||(s=setTimeout(a,d)),r}}function C(){var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.msOverflowStyle="scrollbar",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var n=document.createElement("div");n.style.width="100%",e.appendChild(n);var o=n.offsetWidth;return e.parentNode.removeChild(e),t-o}function x(){var e=((new Date).getTime()/1e3|0).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)}).toLowerCase()}function k(e,t,n){angular.forEach(e,function(e){e.forEach(function(e){e.canAutoResize?e.width=0:(t-=e.width,n-=e.flexGrow)})});var o={},i=t,r=function(){var t=i/n;i=0,angular.forEach(e,function(e){e.forEach(function(e,n){if(e.canAutoResize&&!o[n]){var r=e.width+e.flexGrow*t;void 0!==e.minWidth&&r-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,s=r/i.length,l=o>t;i.forEach(function(e){if(l)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+s;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function z(e,t){return{left:T(e.left),center:T(e.center),right:T(e.right),total:T(t)}}function E(e,t,n){return{restrict:"E",replace:!0,controller:ne,scope:!0,bindToController:{options:"=",rows:"=",selected:"=?",expanded:"=?",onSelect:"&",onSort:"&",onTreeToggle:"&",onPage:"&",onRowClick:"&",onRowDblClick:"&",onColumnResize:"&"},controllerAs:"dt",template:function(e){var t=e[0].getElementsByTagName("column"),n=x();return Q.saveColumns(n,t),'\n \n \n \n \n \n \n
'},compile:function(o,i){return{pre:function(o,i,r,s){function l(){var e=i[0].getBoundingClientRect();if(s.options.internal.innerWidth=Math.floor(e.width),s.options.scrollbarV){var t=e.height;s.options.headerHeight&&(t-=s.options.headerHeight),s.options.footerHeight&&(t-=s.options.footerHeight),s.options.internal.bodyHeight=t,s.calculatePageSize()}s.adjustColumns()}Q.buildColumns(o,n);var a=i.attr("data-column-id"),c=Q.columns[a];c&&(s.options.columns=c),s.transposeColumnDefaults(),s.options.internal.scrollBarWidth=C(),e.addEventListener("resize",b(function(){t(l)}));var d=function u(){var e=i[0].getBoundingClientRect(),n=e.width&&e.height;n?l():t(u,100)};d(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}E.$inject=["$window","$timeout","$parse"],y.$inject=["$document","$timeout"],w.$inject=["$timeout"],v.$inject=["$timeout"],m.$inject=["$compile"],g.$inject=["$timeout"],p.$inject=["$timeout","$rootScope"],r.$inject=["$rootScope","$compile","$log","$timeout"],Object.defineProperty(e,"__esModule",{value:!0});var W=function(){function e(e,t){for(var n=0;n0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.page>1&&this.selectPage(--this.page)}},{key:"nextPage",value:function(){this.selectPage(++this.page)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,l=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&l||!t&&s){var c=this.selected.indexOf(r);if(t&&c>-1){this.selected.splice(c,1);continue}o>=a.start&&ot)&&(i.getRows(),r=!0)}),t.$watch("body.options.paging.count",function(e){i.count=e,i.updatePage()}),t.$watch("body.options.paging.offset",function(e){i.options.paging.size&&i.onPage({offset:e,size:i.options.paging.size})})}}return e.$inject=["$scope","$timeout"],W(e,[{key:"rowsUpdated",value:function(e,n){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var o=e&&n&&(e.length===n.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,s=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],s=t[n.treeColumn.prop],l=n.rowsByGroup[s],a=n.expanded[s];(i>0||!r)&&(o.push(t),l&&l.length>0&&a&&e(l,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);it.sortPriority)return 1;if(e.sortPriority-1){var e=this.options.columns[n];e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()}this.onColumnResize&&this.onColumnResize({column:e,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),oe=angular.module("data-table",[]).directive("dtable",E).directive("resizable",y).directive("sortable",w).directive("dtHeader",v).directive("dtHeaderCell",m).directive("dtBody",g).directive("dtScroller",p).directive("dtSeletion",h).directive("dtRow",u).directive("dtGroupRow",c).directive("dtCell",r).directive("dtFooter",i).directive("dtPager",o);e["default"]=oe});
\ No newline at end of file
diff --git a/src/components/DataTableController.js b/src/components/DataTableController.js
index 94b1d37..64296c5 100644
--- a/src/components/DataTableController.js
+++ b/src/components/DataTableController.js
@@ -11,7 +11,7 @@ export class DataTableController {
* @param {filter}
*/
/*@ngInject*/
- constructor($scope, $filter, $log, $transclude){
+ constructor($scope, $filter, $log, $transclude, $window){$window.dt = this;
Object.assign(this, {
$scope: $scope,
$filter: $filter,
@@ -59,6 +59,14 @@ export class DataTableController {
if(this.options.selectable && this.options.multiSelect){
this.selected = this.selected || [];
+
+ this.$scope.$watch('dt.selected', (newVal, oldVal) => {
+ angular.forEach(this.options.columns, (column) => {
+ if (column.headerCheckbox && angular.isFunction(column.headerCheckboxCallback)) {
+ column.headerCheckboxCallback(this);
+ }
+ });
+ }, true);
}
}
@@ -228,18 +236,18 @@ export class DataTableController {
this.options.internal.setYOffset(offsetY);
}
- /**
- * Invoked when the header checkbox directive has changed.
- */
- onHeaderCheckboxChange(){
- if(this.rows){
- var matches = this.selected.length === this.rows.length;
- this.selected.splice(0, this.selected.length);
+ selectAllRows(){
+ this.selected.splice(0, this.selected.length);
- if(!matches){
- this.selected.push(...this.rows);
- }
- }
+ this.selected.push(...this.rows);
+
+ return this.isAllRowsSelected();
+ }
+
+ deselectAllRows(){
+ this.selected.splice(0, this.selected.length);
+
+ return this.isAllRowsSelected();
}
/**
@@ -247,8 +255,7 @@ export class DataTableController {
* @return {Boolean} if all selected
*/
isAllRowsSelected(){
- if(this.rows) return false;
- return this.selected.length === this.rows.length;
+ return (!this.rows || !this.selected) ? false : this.selected.length === this.rows.length;
}
/**
@@ -304,5 +311,4 @@ export class DataTableController {
row: row
});
}
-
}
diff --git a/src/components/DataTableDirective.js b/src/components/DataTableDirective.js
index 521c303..3511de1 100644
--- a/src/components/DataTableDirective.js
+++ b/src/components/DataTableDirective.js
@@ -33,12 +33,12 @@ export function DataTableDirective($window, $timeout, $parse){
return `