Hi, I’m trying to hide a table column if it is empty. I have a large database of products for which all technical specs are not relevant.
Here for example I need to hide several blank columns. Can anyone help? I have no experience with coding. thanks
$w.onReady(() => {
$w('#dataset').onReady(() => {
const rows = $w('#table').rows;
const columns = $w('#table').columns;
if(rows.length){
colomns.forEach(col => {
const rowsWithCellValue= rows.filter(row => row[col.dataPath]);
col.visible = !!rowsWithCellValue.length;
})
$w('#table').columns = columns;
}
})
})
1 Like
Hi J.D, thanks for the help. Unfortunately this does not seem to work. I did change the values to my #dataset2 and #table1. Is there anything else I need to change?
oups forgot a parenthesis, it works perfectly!
Thanks soooo much!!!