Hi guys, hope somebody can help with this. I have a table with data about boxers and I need to show numbers for each row to see how many of them are there. Numbers should be from 1 to the number of the last item. I also have filters so I need to know number of them in each filter. I suppose this is not a big deal but still a newbie! Thanks in advance
You can do something like:
fucntion setRowNumbers(){
let rows = $w('#table1').rows;
rows = rows.map((e,i) => {e.indexField = (i + 1).toString(); return e;});
$w('#table1').rows = rows;
}
$w.onReady(() => {
$w('#dataset1').onReady(() => {
//set the column:
let columns = $w('#table1').columns;
columns.unshift(
{
"id": "index",
"dataPath": "indexField",
"label": "Number",
"width": 100,
"visible": true,
"type": "string",
}
);
$w('#table1').columns = columns;
setRowNumbers();
})
///in an event handler when you run your filter:
$w('#dataset1').setFilter(/*filter here*/)
.then(() => setRowNumbers());
//end of event handler
})
[UPDATED]