Hi,
Very new to Wix and its coding.
Am trying to display contents from a dataset onto a table. Tried trouble shooting but the modified fields just dont show up.
The following is the code :
import wixData from ‘wix-data’ ;
import wixUsers from ‘wix-users’ ;
$w.onReady( function () {
//TODO: write your page related code here…
$w( “#table2” ).rows = ;
const currentColumns = $w( “#table2” ).columns;
const calculatedColumns = [
{
“id” : “col_Gift_Image” ,
“dataPath” : “giftImage” ,
“label” : “Gift” ,
“type” : “image” ,
},
{
“id” : “colMessage” ,
“dataPath” : “message” ,
“label” : “Message” ,
“type” : “richText” ,
}
];
$w( “#table2” ).columns = currentColumns.concat(calculatedColumns);
$w( “#table2” ).refresh();
wixData.query( “Gift_Submission” )
.find()
.then( (results) => {
let rows = $w( “#table2” ).rows;
console.log($w( “#table2” ).columns + “The table initially” );
for ( let i= 0 ; i < results.totalCount; i++) {
rows[i][ “_createdDate” ] = results.items[i][ “_createdDate” ];
rows[i][ “UserName.nickname” ] = results.items[i][ “UserName” ];
rows[i][ “message” ] = results.items[i][ “Gift_Message” ];
rows[i][ “giftImage” ] = results.items[i][ “Gift_Image” ];
$w( “#table2” ).rows[i] = rows[i];
}
});
});
The result is :, even when there is data in the dataset - Gift_Submission