</button>
<!-- actions drop-down menu -->
- <div class="btn-group" ng-if="actions.length" dropdown>
+ <div class="btn-group" ng-if="actionGroups.length > 1 || actionGroups[0].actions.length" dropdown>
<button type="button" class="btn btn-default dropdown-toggle">
[% l('Actions') %] <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right grid-action-dropdown">
- <li ng-repeat="action in actions" ng-class="{divider: action.divider}" ng-hide="actionHide(action)">
+ <li ng-repeat-start="group in actionGroups">
+ <span style="padding-left: 1em;" ng-if="group.label"><strong><u>{{group.label}}</u></strong></span>
+ </li>
+ <li ng-repeat="action in group.actions" ng-class="{divider: action.divider}" ng-hide="actionHide(action)">
<a ng-if="!action.divider" href
ng-click="actionLauncher(action)">{{action.label}}</a>
</li>
+ <span ng-repeat-end/>
</ul>
</div>
$scope.showGridConf = false;
grid.totalCount = -1;
$scope.selected = {};
- $scope.actions = []; // actions for selected items
+ $scope.actionGroups = [{actions:[]}]; // Grouped actions for selected items
$scope.menuItems = []; // global actions
// remove some unneeded values from the scope to reduce bloat
// add a selected-items action
grid.addAction = function(act) {
- $scope.actions.push(act);
+ var done = false;
+ $scope.actionGroups.forEach(function(g){
+ if (g.label === act.group) {
+ g.actions.push(act);
+ done = true;
+ }
+ });
+ if (!done) {
+ $scope.actionGroups.push({
+ label : act.group,
+ actions : [ act ]
+ });
+ }
}
// remove the stored column configuration preferenc, then recover
restrict : 'AE',
transclude : true,
scope : {
+ group : '@', // Action group, ungrouped if not set
label : '@', // Action label
handler : '=', // Action function handler
hide : '=',
link : function(scope, element, attrs, egGridCtrl) {
egGridCtrl.addAction({
hide : scope.hide,
+ group : scope.group,
label : scope.label,
divider : scope.divider,
handler : scope.handler