Skip to content

Commit 0a9afa1

Browse files
committed
pfFilterResults: add 'n of m selected' label
1 parent 6d40f5d commit 0a9afa1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/filters/filter-results-component.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* </ul>
2020
* <li>.appliedFilters - (Array) List of the currently applied filters
2121
* <li>.resultsCount - (int) The number of results returned after the current applied filters have been applied
22+
* <li>.selectedCount - (int) The number selected items, The 'n' in the label: 'n' of 'm' selected
23+
* <li>.totalCount - (int) The total number of items before any filters have been applied. The 'm' in the label: 'n' of 'm' selected
2224
* <li>.onFilterChange - ( function(array of filters) ) Function to call when the applied filters list changes
2325
* </ul>
2426
*
@@ -61,6 +63,12 @@ angular.module('patternfly.filters').component('pfFilterResults', {
6163
if (ctrl.config.resultsCount === undefined) {
6264
ctrl.config.resultsCount = 0;
6365
}
66+
if (ctrl.config.selectedCount === undefined) {
67+
ctrl.config.selectedCount = 0;
68+
}
69+
if (ctrl.config.totalCount === undefined) {
70+
ctrl.config.totalCount = 0;
71+
}
6472
}
6573

6674
function clearFilter (item) {

src/filters/filter-results.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ <h5>{{$ctrl.config.resultsCount}} Results</h5>
1212
</li>
1313
</ul>
1414
<p><a class="clear-filters" ng-click="$ctrl.clearAllFilters()" ng-if="$ctrl.config.appliedFilters.length > 0">Clear All Filters</a></p>
15+
<div ng-if="$ctrl.config.totalCount !== 0" class="pf-table-view-selected-label">
16+
<strong>{{$ctrl.config.selectedCount}}</strong> of <strong>{{$ctrl.config.totalCount}}</strong> selected
17+
</div>
1518
</div><!-- /col -->
1619
</div><!-- /row -->
1720
</div>

0 commit comments

Comments
 (0)