Skip to content

Commit 64c5b76

Browse files
committed
Implemented two-way syncing of view, filters and picked-columns on pf-toolbar
1 parent 71ce5bc commit 64c5b76

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ All notable changes to this project will be documented in this file.
44
## [Unreleased]
55
### Added
66
- Implemented `v-model` on the page property `pf-paginate-control` components.
7-
- Implemented two-way syncing of `sort-by` and `sort-direction` properties in `pf-table`.
7+
- Implemented two-way syncing of `sort-by` and `sort-direction` properties in `pf-table` and `pf-toolbar`.
88
- Implemented `pf-application-launcher` and `pf-launcher-item`.
99
- Implemented `pf-notification-bell` as a toggler for the `pf-drawer`.
1010
- Added `navbar-brand-name` CSS class to correctly style text-only brand titles.
1111
- Documented `v-tooltip` directive
1212
- Implemented `data-placement` attribute as an alternative way to specify the tooltip positions.
1313

1414
### Changed
15-
- **BACKWARD INCOMPATIBLE CHANGE**: The page property of `pf-table` components can now be synced with `:page.sync="mypagenr"`. As a result of this change the `change-page` event has now been renamed to `update:page`.
15+
- **BACKWARD INCOMPATIBLE CHANGE**: The `page` property of `pf-table` components can now be synced with `:page.sync="mypagenr"`. As a result of this change the `change-page` event has now been renamed to `update:page`.
16+
- **BACKWARD INCOMPATIBLE CHANGE**: The `view`, `filters` and `picked-columns` properties of `pf-toolbar` components can now be synced with the `.sync` `v-bind` modifier. As a result of this change the `view` event has now been renamed to `update:view`; the `filters` event has been renamed to `update:filters` and the `columns` event to `update:pickedColumns`.
1617

1718
## [0.0.12] - 2017-05-07
1819
### Added

docs/src/pages/toolbar.vue

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,17 @@
1313
</ol>
1414

1515
<pf-toolbar ref="toolbar"
16-
:view="toolbar.view"
16+
:view.sync="toolbar.view"
1717
:views="toolbar.views"
18-
@view="toolbar.view = arguments[0]"
19-
@columns="toolbar.pickedColumns = arguments[0]"
20-
@filters="toolbar.filters = arguments[0]"
21-
:filters="toolbar.filters"
18+
:filters.sync="toolbar.filters"
2219
:filter-fields="toolbar.filterFields"
23-
@sort-by="setSort"
24-
:sort-by="toolbar.sortBy"
25-
:sort-direction="toolbar.sortDirection"
20+
:sort-by.sync="toolbar.sortBy"
21+
:sort-direction.sync="toolbar.sortDirection"
2622
:sort-fields="toolbar.sortFields"
2723
:result-count="toolbar.resultCount"
2824
:attached="toolbar.attached"
2925
:columns="toolbar.columns"
30-
:picked-columns="toolbar.pickedColumns">
26+
:picked-columns.sync="toolbar.pickedColumns">
3127

3228
<div v-if="toolbar.slotDefault" v-html="toolbar.slotDefault" style="float:left"></div>
3329

@@ -125,10 +121,6 @@ export default {
125121
},
126122
127123
methods: {
128-
setSort(field, direction) {
129-
this.toolbar.sortBy = field;
130-
this.toolbar.sortDirection = direction;
131-
},
132124
addFilter(filter, value) {
133125
const f = {};
134126
f[filter.title] = value;

src/components/Toolbar.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ export default {
112112
methods: {
113113
setSortBy(field, direction) {
114114
this.$emit('sort-by', field, direction);
115+
this.$emit('update:sortBy', field);
116+
this.$emit('update:sortDirection', direction);
115117
},
116118
clearFilter(i) {
117119
this.activeFilters.splice(i, 1);
@@ -123,7 +125,7 @@ export default {
123125
this.activeFilters.push(filter);
124126
},
125127
setPickedColumns(columns) {
126-
this.$emit('columns', columns);
128+
this.$emit('update:pickedColumns', columns);
127129
},
128130
},
129131
@@ -194,10 +196,10 @@ export default {
194196
immediate: true,
195197
},
196198
activeView() {
197-
this.$emit('view', this.activeView);
199+
this.$emit('update:view', this.activeView);
198200
},
199201
activeFilters() {
200-
this.$emit('filters', this.activeFilters);
202+
this.$emit('update:filters', this.activeFilters);
201203
},
202204
},
203205
};

0 commit comments

Comments
 (0)