Datasheet - Sort

Hi tomer,

here’s the full page code… No error in dev console ! Is it a obligation to assign ascending code to a button ? Because I always need ascending sort for this table. When adding sorting code first line diplay a error !?


Here’s full page code

import wixData from ‘wix-data’;

export function importButton_click_1(event) {
const items = JSON.parse($w(“#textBox”).value);
const collection = $w(“#collectionInput”).value;

items.forEach( (item) => {
wixData.insert(collection, item)
.then( (results) => {
console.log(Added item: ${JSON.stringify(results)});
} )
.catch( (err) => {
console.log(err);
} );
} );

$w(“#textBox”).value = “”;
}

export function button27_click(event) {
let collection = $w(“#collectionInput”).value;

wixData.query(collection)
.find()
.then( (results) => {
$w(“#textBox”).value = JSON.stringify(results.items);
} )
.catch( (err) => {
console.log(err);
} );
}
export function button35_click(event, $w) {
$w(“PLAYERS_NAME_IMPORT”).setSort( wixData.sort()
.ascending(“record”)
);
}