Skip to content

Commit b466ef4

Browse files
authored
Merge pull request #714 from jcaianirh/issue-693
chore(pfToolbar): updated ngdoc with 'no filter results' empty state instead of 'No Items Available'
2 parents 46baacd + d0e6fed commit b466ef4

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/toolbars/examples/toolbar.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<pf-list-view config="listConfig"
8585
page-config="pageConfig"
8686
items="items"
87-
empty-state-config="emptyStateConfig">
87+
empty-state-config="items.length === 0 && filterConfig.appliedFilters.length > 0 ? noItemsConfig : emptyStateConfig">
8888
<div class="list-view-pf-description">
8989
<div class="list-group-item-heading">
9090
{{item.name}}
@@ -107,7 +107,7 @@
107107
<pf-card-view config="listConfig"
108108
page-config="pageConfig"
109109
items="items"
110-
empty-state-config="emptyStateConfig">
110+
empty-state-config="items.length === 0 && filterConfig.appliedFilters.length > 0 ? noItemsConfig : emptyStateConfig">
111111
<div class="col-md-12">
112112
<span>{{item.name}}</span>
113113
</div>
@@ -124,7 +124,7 @@
124124
page-config="pageConfig"
125125
columns="columns"
126126
items="items"
127-
empty-state-config="emptyStateConfig">
127+
empty-state-config="items.length === 0 && filterConfig.appliedFilters.length > 0 ? noItemsConfig : emptyStateConfig">
128128
</pf-table-view>
129129
</div>
130130
<hr class="col-md-12">
@@ -287,6 +287,11 @@
287287
}
288288
};
289289
290+
var clearFilters = function() {
291+
filterChange([]);
292+
$scope.filterConfig.appliedFilters = [];
293+
};
294+
290295
var filterChange = function (filters) {
291296
$scope.filtersText = "";
292297
filters.forEach(function (filter) {
@@ -488,6 +493,15 @@
488493
}
489494
};
490495
496+
$scope.noItemsConfig = {
497+
title: 'No Results Match the Filter Criteria',
498+
info: 'The active filters are hiding all items.',
499+
helpLink: {
500+
urlLabel: 'Clear All Filters',
501+
urlAction: clearFilters
502+
}
503+
};
504+
491505
$scope.tableConfig = {
492506
onCheckBoxChange: handleCheckBoxChange,
493507
selectionMatchProp: "name",

0 commit comments

Comments
 (0)