Skip to content

Commit 71ce5bc

Browse files
committed
Implemented two-way syncing of sort-by and sort-direction properties in pf-table
1 parent 3006048 commit 71ce5bc

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ 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`.
78
- Implemented `pf-application-launcher` and `pf-launcher-item`.
89
- Implemented `pf-notification-bell` as a toggler for the `pf-drawer`.
910
- Added `navbar-brand-name` CSS class to correctly style text-only brand titles.

docs/src/pages/table.vue

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
:selectable="table.selectable"
1616
:sortable="table.sortable"
1717
:scrollable="table.scrollable"
18-
:sort-by="table.sortBy"
19-
:sort-direction="table.sortDirection"
20-
@sort-by="setSort"
18+
:sort-by.sync="table.sortBy"
19+
:sort-direction.sync="table.sortDirection"
2120
style="height:250px">
2221
<template scope="data">
2322
<td style="width:50px">#{{data.row.id}}</td>
@@ -223,12 +222,5 @@ export default {
223222
},
224223
};
225224
},
226-
227-
methods: {
228-
setSort(field, direction) {
229-
this.table.sortBy = field;
230-
this.table.sortDirection = direction;
231-
},
232-
}
233225
};
234226
</script>

src/components/Table.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ export default {
214214
methods: {
215215
setSortBy(field, direction) {
216216
this.$emit('sort-by', field, direction);
217+
this.$emit('update:sortBy', field);
218+
this.$emit('update:sortDirection', direction);
217219
},
218220
219221
changeSelectAll(e) {

0 commit comments

Comments
 (0)