Hi bminehart ,
To concatenate columns in a table widget, try these steps:
- Add col1 and col2 to the table widget.
- Add the following widget script. Make sure to update the variables column1_index and column2_index with the respective indices of the two columns you want to concatenate. The script will display the concatenated string in the column with index column1_index and hide the column with index column2_index.
const column1_index = 1;
const column2_index = 2;
widget.on('processresult', function(w, args){
args.result.$$rows.forEach(item => {
item[column1_index].text = `${item[column1_index].text} ${item[column2_index].text}`;
})
})
//Refer: https://www.binextlevel.com/post/hide-a-column-from-table-widget
widget.on('domready', function(se, ev){
$(`table tr > *:nth-child(${column2_index + 1})`, element).css('display', 'none')
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){
$(value).find(`td:nth-child(${column2_index + 1})`).css('display', 'none')
})
}
}
})
observer.observe(elementToObserve, {subtree: true, childList: true});
})
3. Refresh the widget.
![]()
For more details on how to hide a column in the table widget, refer to this post: https://www.binextlevel.com/post/hide-a-column-from-table-widget
-Hari