widget.on('domready', function(se, ev){
// Specify the column indices to hide
let columnIndices = [1, 3, 5];
// Function to hide columns
function hideColumns() {
columnIndices.forEach(function(columnIndex) {
$(`table tr > *:nth-child(${columnIndex})`, element).css('display', 'none');
});
}
// Initial hiding of columns
hideColumns();
// Observe changes in the table body
const elementToObserve = $('table tbody', element)[0];
const observer = new MutationObserver(function(e) {
for(const m of e) {
if (m.type === 'childList') {
$.each(m.addedNodes, function(index, value){
// Hide columns in added rows
columnIndices.forEach(function(columnIndex) {
$(value).find(`td:nth-child(${columnIndex})`).css('display', 'none');
});
});
}
}
});
observer.observe(elementToObserve, {subtree: true, childList: true});
});