Hi there, trying to create one button to sort data in table, i know how to create 2 separate buttons to Ascending/Descending but need help to create one for the two actions if sort is already on
Table image
Code for the buttons
import wixData from 'wix-data';
$w.onReady( function() {
$w("#PtsButton").onClick( (event, $w) => {
console.log(wixData)
$w("#dataset1").setSort( wixData.sort()
.descending("pts") );
} );
$w("#PtsButtonDown").onClick( (event, $w) => {
$w("#dataset1").setSort( wixData.sort()
.ascending("pts") );
} );
} );
appreciate the help