Skip to content

Commit 70e8cc7

Browse files
committed
Updated bootstrap multiple grids sample - added new column to table with filtering logic
1 parent 79a222b commit 70e8cc7

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Diff for: demo/bootstrap/js/multipleApp.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
angular.module('myApp', ['ui.bootstrap', 'dataGrid', 'pagination'])
22
.controller('myAppController', ['$scope', function ($scope) {
3+
$scope.statuses = ['On Vacation','Terminated','Employed'];
34

45
$scope.gridOptions1 = {
56
data: generateJSON(100)
@@ -26,6 +27,7 @@ angular.module('myApp', ['ui.bootstrap', 'dataGrid', 'pagination'])
2627
item.name = names[Math.round(Math.random() * (names.length - 1))];
2728
item.phone = '+375-29-' + Math.round(Math.random() * 1000000);
2829
item.date = Math.round(Math.random() * 1000000000000);
30+
item.status = $scope.statuses[Math.round(Math.random() * ($scope.statuses.length - 1))];
2931
jsonObj.push(item);
3032

3133
}

Diff for: demo/bootstrap/multiple.html

+26
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ <h2>First Grid</h2>
8686
<th sortable="date" class="sortable">
8787
Date Of Birth
8888
</th>
89+
<th class="st-sort-disable th-dropdown">
90+
<select class="form-control width-15"
91+
filter-by="status"
92+
filter-type="select"
93+
ng-model="status"
94+
ng-change="filter()">
95+
<option value="">All Statuses</option>
96+
<option ng-repeat="option in statuses track by $index"
97+
value="{{option}}">{{option}}
98+
</option>
99+
</select>
100+
</th>
89101
</tr>
90102
</thead>
91103
<tbody>
@@ -94,6 +106,7 @@ <h2>First Grid</h2>
94106
<td ng-bind="item.name"></td>
95107
<td ng-bind="item.phone"></td>
96108
<td width="30%" ng-bind="item.date | date:'MM/dd/yyyy'"></td>
109+
<td ng-bind="item.status"></td>
97110
</tr>
98111
</tbody>
99112
</table>
@@ -182,6 +195,18 @@ <h2>Second Grid</h2>
182195
<th sortable="date" class="sortable">
183196
Date Of Birth
184197
</th>
198+
<th class="st-sort-disable th-dropdown">
199+
<select class="form-control width-15"
200+
filter-by="status"
201+
filter-type="select"
202+
ng-model="status"
203+
ng-change="filter()">
204+
<option value="">All Statuses</option>
205+
<option ng-repeat="option in statuses track by $index"
206+
value="{{option}}">{{option}}
207+
</option>
208+
</select>
209+
</th>
185210
</tr>
186211
</thead>
187212
<tbody>
@@ -190,6 +215,7 @@ <h2>Second Grid</h2>
190215
<td ng-bind="item.name"></td>
191216
<td ng-bind="item.phone"></td>
192217
<td width="30%" ng-bind="item.date | date:'MM/dd/yyyy'"></td>
218+
<td ng-bind="item.status"></td>
193219
</tr>
194220
</tbody>
195221
</table>

0 commit comments

Comments
 (0)