@@ -19,6 +19,10 @@ can select a different row (which will unselect the current row), but you cannot
19
19
by clicking on it. This means that at least one row is always selected, other than when you first open the grid. If
20
20
necessary you could programatically select the first row upon page open. The second grid demonstrates this.
21
21
22
+ If `multiSelect: true`, another option `modifierKeysToMultiSelect` may be used. If set to true will allow selecting multiple
23
+ row only if the Ctrl-Key, Cmd-Key (Mac) or the Shift-Key is used when selecting, set to false will allow selecting multiple
24
+ rows always.
25
+
22
26
@example
23
27
Two examples are provided, the first with rowHeaderSelection and multi-select, the second without.
24
28
@@ -46,19 +50,23 @@ Two examples are provided, the first with rowHeaderSelection and multi-select, t
46
50
$scope.info = {};
47
51
48
52
$scope.toggleMultiSelect = function() {
49
- $scope.gridApi.selection.setMultiSelect(!$scope.gridApi.grid.options.multiSelect);
53
+ $scope.gridApi.selection.setMultiSelect(!$scope.gridApi.grid.options.multiSelect);
54
+ };
55
+
56
+ $scope.toggleModifierKeysToMultiSelect = function() {
57
+ $scope.gridApi.selection.setModifierKeysToMultiSelect(!$scope.gridApi.grid.options.modifierKeysToMultiSelect);
50
58
};
51
59
52
60
$scope.selectAll = function() {
53
- $scope.gridApi.selection.selectAllRows();
61
+ $scope.gridApi.selection.selectAllRows();
54
62
};
55
63
56
- $scope.clearAll = function() {
57
- $scope.gridApi.selection.clearSelectedRows();
58
- };
64
+ $scope.clearAll = function() {
65
+ $scope.gridApi.selection.clearSelectedRows();
66
+ };
59
67
60
68
$scope.toggleRow1 = function() {
61
- $scope.gridApi.selection.toggleRowSelection($scope.gridOptions.data[0]);
69
+ $scope.gridApi.selection.toggleRowSelection($scope.gridOptions.data[0]);
62
70
};
63
71
64
72
$scope.gridOptions.onRegisterApi = function(gridApi){
@@ -82,6 +90,7 @@ Two examples are provided, the first with rowHeaderSelection and multi-select, t
82
90
];
83
91
84
92
$scope.gridOptions.multiSelect = false;
93
+ $scope.gridOptions.modifierKeysToMultiSelect = false;
85
94
$scope.gridOptions.noUnselect = true;
86
95
$scope.gridOptions.onRegisterApi = function( gridApi ) {
87
96
$scope.gridApi = gridApi;
@@ -98,15 +107,18 @@ Two examples are provided, the first with rowHeaderSelection and multi-select, t
98
107
</file>
99
108
<file name="index.html">
100
109
<div ng-controller="MainCtrl">
101
- <button type="button" class="btn btn-success" ng-click="toggleMultiSelect()">Toggle multiSelect</button> <strong>MultiSelect:</strong> <span ng-bind="gridApi.grid.options.multiSelect"></span>
102
- <button type="button" class="btn btn-success" ng-click="toggleRow1()">Toggle Row 0</button> </span>
110
+ <button type="button" class="btn btn-success" ng-click="toggleMultiSelect()">Toggle multiSelect</button> <strong>MultiSelect:</strong> <span ng-bind="gridApi.grid.options.multiSelect"></span>
111
+ <button type="button" class="btn btn-success" ng-click="toggleRow1()">Toggle Row 0</button>
103
112
<br/>
104
113
<br/>
105
- <button type="button" class="btn btn-success" ng-disabled="!gridApi.grid.options.multiSelect" ng-click="selectAll()">Select All</button> </span>
106
- <button type="button" class="btn btn-success" ng-click="clearAll()">Clear All</button> </span>
107
- <br>
114
+ <button type="button" class="btn btn-success" ng-click="toggleModifierKeysToMultiSelect()">Toggle modifierKeysToMultiSelect</button> <strong>ModifierKeysToMultiSelect:</strong> <span ng-bind="gridApi.grid.options.modifierKeysToMultiSelect"> </span>
115
+ <br/>
116
+ <br/>
117
+ <button type="button" class="btn btn-success" ng-disabled="!gridApi.grid.options.multiSelect" ng-click="selectAll()">Select All</button>
118
+ <button type="button" class="btn btn-success" ng-click="clearAll()">Clear All</button>
119
+ <br/>
120
+
108
121
<div ui-grid="gridOptions" ui-grid-selection class="grid"></div>
109
-
110
122
</div>
111
123
<div ng-controller="SecondCtrl">
112
124
Single selection grid without rowHeader:
0 commit comments