From 1952a34cdacef127b2b053366284f225a25ec545 Mon Sep 17 00:00:00 2001 From: swimming pool <97299566+web-swpl@users.noreply.github.com> Date: Fri, 10 Mar 2023 11:30:24 +0000 Subject: [PATCH] Change sorting icons to properly reflect the sorting state --- src/components/datatable/HeaderCell.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/datatable/HeaderCell.vue b/src/components/datatable/HeaderCell.vue index bc8a33ad9d..4cf3a6aa6f 100644 --- a/src/components/datatable/HeaderCell.vue +++ b/src/components/datatable/HeaderCell.vue @@ -29,6 +29,9 @@ import ColumnSlot from './ColumnSlot.vue'; import HeaderCheckbox from './HeaderCheckbox.vue'; import ColumnFilter from './ColumnFilter.vue'; +const ascIcon = 'pi-sort-amount-up'; +const descIcon = 'pi-sort-amount-down'; + export default { props: { column: { @@ -217,17 +220,17 @@ export default { return [ 'p-sortable-column-icon pi pi-fw', { 'pi-sort-alt': !sorted, - 'pi-sort-amount-up-alt': sorted && sortOrder > 0, - 'pi-sort-amount-down': sorted && sortOrder < 0 + [ascIcon]: sorted && sortOrder > 0, + [descIcon]: sorted && sortOrder < 0 } ]; }, ariaSort() { if (this.columnProp('sortable')) { const sortIcon = this.sortableColumnIcon; - if (sortIcon[1]['pi-sort-amount-down']) + if (sortIcon[1][descIcon]) return 'descending'; - else if (sortIcon[1]['pi-sort-amount-up-alt']) + else if (sortIcon[1][ascIcon]) return 'ascending'; else return 'none';