|
5 | 5 | * |
6 | 6 | * @description |
7 | 7 | * The Filter Panel is opened and closed by clicking on the Filter button. It can contain any HTML desired by |
8 | | - * the end user. As such, the end user is repsonsible for constructing the <code>appliedFilters</code> array which is passed to |
| 8 | + * the application developer. As such, the application developer is repsonsible for constructing the <code>appliedFilters</code> array which is passed to |
9 | 9 | * the filter results tags. |
10 | | - * The end user is responsible for filtering items based on the <code>appliedFilters</code> array; both when a |
| 10 | + * The application developer is responsible for filtering items based on the <code>appliedFilters</code> array; both when a |
11 | 11 | * filter is changed on the panel, or when a filter tag is 'cleared' (by user clicking on 'x' in the filter results tag). |
12 | 12 | * <br> |
13 | 13 | * |
|
245 | 245 |
|
246 | 246 | var applyFilters = function () { |
247 | 247 | var newAppliedFilters = []; |
248 | | - $scope.filterPanelModel.forEach(function (filter) { |
| 248 | + _.forEach($scope.filterPanelModel, function(filter) { |
249 | 249 | var filterValues = []; |
250 | 250 | if (angular.isDefined(filter.values) && filter.values.length > 0) { |
251 | 251 | if(filter.filterType === "checkbox") { |
252 | 252 | // the values of the selected checkboxes are stored in a single new appliedFilter |
253 | | - filter.values.forEach(function (value) { |
| 253 | + _.forEach(filter.values, function(value) { |
254 | 254 | if(value.selected) { |
255 | 255 | filterValues.push(value.value) |
256 | 256 | } |
|
260 | 260 | } |
261 | 261 | } else { |
262 | 262 | // each keyword value gets a new appliedFilter |
263 | | - filter.values.forEach(function (value) { |
| 263 | + _.forEach(filter.values, function(value) { |
264 | 264 | filterValues = [value]; |
265 | 265 | newAppliedFilters.push( createAppliedFilter (filter, filterValues) ); |
266 | 266 | }); |
|
294 | 294 | }; |
295 | 295 |
|
296 | 296 | var resetFilterPanelModel = function () { |
297 | | - $scope.filterPanelModel.forEach(function (filter) { |
| 297 | + _.forEach($scope.filterPanelModel, function(filter) { |
298 | 298 | if (angular.isDefined(filter.values) && filter.values.length > 0) { |
299 | 299 | if(filter.filterType === "checkbox") { |
300 | 300 | // unselect all checkboxes |
|
306 | 306 | filter.values = []; |
307 | 307 | } |
308 | 308 | } |
309 | | - }); |
| 309 | + }); |
310 | 310 | }; |
311 | 311 |
|
312 | 312 | var filterItems = function (filters) { |
313 | 313 | $scope.items = []; |
314 | 314 | if (filters && filters.length > 0) { |
315 | | - $scope.allItems.forEach(function (item) { |
| 315 | + _.forEach($scope.allItems, function(item) { |
316 | 316 | if (matchesFilters(item, filters)) { |
317 | 317 | $scope.items.push(item); |
318 | 318 | } |
|
0 commit comments