Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
Add option to add/override scope properties backing the table
Browse files Browse the repository at this point in the history
useful for:
- additional methods to be called from within cell templates
- further customizing default behavior
  • Loading branch information
Lukas Hinsch authored and Lukas Hinsch committed Jan 5, 2016
1 parent 90bba78 commit 6fc9501
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
25 changes: 14 additions & 11 deletions dist/mindsmash-angular-uxtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@
keyboard: true,
selection: true,
selectionKey: 'id',
rowAction: angular.noop // function(row, idx, api, $event)...
rowAction: angular.noop, // function(row, idx, api, $event)...
mobileViewSize: undefined, // media size to display mobile view (xs,sm,...), multiple values as comma-separated list
mobileViewTemplate: undefined, // replacement template for mobile view (instead of table),
scope: {} // additions/overrides to the scope backing the table (additional action methods etc.)
},
pagination: {
ngClass: 'ux-table-pagination',
Expand Down Expand Up @@ -464,16 +467,6 @@
},
controller: ['$scope', function($scope) {
this.api = $scope.api();

(function(viewConf) {
console.log(viewConf);
if (!!viewConf.mobileViewTemplate && !!viewConf.mobileViewSize) {
$scope.mobile = screenSize.is(viewConf.mobileViewSize);
screenSize.on(viewConf.mobileViewSize, function (mobile) {
$scope.mobile = mobile;
});
}
}(this.api.getConfig().view));
}],
link: function($scope, elem, attrs, ctrl) {
var api = ctrl.api;
Expand Down Expand Up @@ -555,6 +548,16 @@
// initialize
updateConf(null, api.getConfig());
updateData(null, api.getData());

var viewConf = $scope.conf.view;
if (!!viewConf.mobileViewTemplate && !!viewConf.mobileViewSize) {
$scope.mobile = screenSize.is(viewConf.mobileViewSize);
screenSize.on(viewConf.mobileViewSize, function (mobile) {
$scope.mobile = mobile;
});
}

angular.extend($scope, api.getConfig().view.scope);
}
};
}])
Expand Down
Loading

0 comments on commit 6fc9501

Please sign in to comment.