Set table widget content property
Functions covered
Composition structure
Composition script
Last updated
Last updated
(function() {
return {
init: function(comp, context) {
// get reference to the standingsTable widget
const wiStandingsTable = comp.findWidget("standingsTable")[0];
// log widget objects to the console
console.log(wiStandingsTable);
// define standings data
const tableData = [{
"Position": 1,
"Name": "The Winner",
"Points": 987
},
{
"Position": 2,
"Name": "Silver medal",
"Points": 876
},
{
"Position": 3,
"Name": "Bronce medal",
"Points": 765
},
{
"Position": 4,
"Name": "4th place",
"Points": 654
},
{
"Position": 5,
"Name": "5th place",
"Points": 543
}
];
// build table content format
const tableContent = {
"content": tableData
};
// update tableContent widget property
// we stringify the tableContent!
wiStandingsTable.setPayload({
"tableContent": JSON.stringify(tableContent)
});
},
close: function(comp, context) {}
};
})();