Hi,
I would like to order on the column I calculated named " ptot " ( rows[k][“ptot”] ).
I tried with the ’ descending (‘ptot’) ’ option on the query2 line but it doesn’t work.
Do you have any suggestions?
let query2 = wixData.query("CLASSIFICHE").contains('campionato', cmp).descending('ptot');
below is the code
thanks and excuse for my bad english
Claudio
let query2 = wixData.query("CLASSIFICHE").contains('campionato', cmp);
query2.find().then((results) =>
{
$w("#table20").rows = results.items;
$w("#table20").columns =
[{
"id": "col0",
"dataPath": "campionato",
"label": "",
"width": 40,
"visible": true,
"type": "string"
},
{
"id": "col1",
"dataPath": "squadre",
"label": "Periodo",
"width": 140,
"visible": true,
"type": "string"
}]
let cols = $w("#table20").columns;
cols.push
({
"id": "col2",
"dataPath": "ptot",
"label": "PT",
"width": 40,
"visible": true,
"type": "number"
});
$w("#table20").columns = cols;
let rows = $w("#table20").rows;
for (var k = 0; k < $w("#table20").rows.length; k++)
{
rows[k]["ptot"] = $w("#table18").rows[k]['punticasaSum'] + $w("#table19").rows[k]['puntifuoriSum'];
}
$w("#table20").rows = rows;
})