Skip to content

Commit

Permalink
feat(Table): reset sort on third click
Browse files Browse the repository at this point in the history
Resolves #300
  • Loading branch information
benjamincanac committed Jun 27, 2023
1 parent 07b27a2 commit 1ff11ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/runtime/components/data/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,13 @@ export default defineComponent({
function onSort (column) {
if (sort.value.column === column.key) {
sort.value.direction = sort.value.direction === 'asc' ? 'desc' : 'asc'
const direction = !column.direction || column.direction === 'asc' ? 'desc' : 'asc'
if (sort.value.direction === direction) {
sort.value = defu({}, props.sort, { column: null, direction: 'asc' })
} else {
sort.value.direction = sort.value.direction === 'asc' ? 'desc' : 'asc'
}
} else {
sort.value = { column: column.key, direction: column.direction || 'asc' }
}
Expand Down

1 comment on commit 1ff11ac

@vercel
Copy link

@vercel vercel bot commented on 1ff11ac Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-nuxtlabs.vercel.app
ui-git-dev-nuxtlabs.vercel.app
ui.nuxtlabs.com

Please sign in to comment.