What the title says. This is my code. The rows properties returns the right data, after, but not actually showing in the table itself
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixLocation from “wix-location”
import wixData from “wix-data”
import {session,local} from “wix-storage”
$w.onReady( function () {
//TODO: write your page related code here…
if ( session.getItem(“logueado”) !== “si”)
wixLocation.to(“/login”)
console.log(local.getItem(“fullname”))
PopulateTable()
.then( (items) => {
$w(“#table1”).rows = items;
console.log($w(‘#table1’).rows)
} );
//$w(“#text1”).text = local.getItem(“fullname”)
});
export function PopulateTable(){
return wixData.query(“pacientes”)
.find()
.then( (results) => {
if (results.items.length > 0) {
let TableData = ;
let TableRowData = {}
let item;
console.log("items " + results.items)
//return results.items
// Add one row at a time to the TableData array by looping through the query results.
for ( var i = 0; i < results.items.length; i++) {
item = results.items[i];
TableRowData = {"Paciente": item.nombrecompleto,"telefono": item.telefono,"email": item.email};
TableData.push(TableRowData);
//console.log(TableData)
//$w(‘#table1’).rows = TableData;
}
return TableData
//console.log($w(‘#table1’).rows)
//$w(‘#table1’).refresh() */
} else {
// no data found
}
} )
. catch ( (err) => {
let errorMsg = err;
} );
}
I want to show only a few fields from the collection, that’s why I need to do it manually.
Cheers, Diego