How to hide columns in child table based on user roles

How to hide columns in child table based on user roles

gorsstakgorsstak Posts: 3Questions: 0Answers: 0

I have responsive table which opens all columns in a popup when user clicks on "+".
Based on user roles I decide whether to show or not some columns in the main table, for this I use "columnDefs": [{ "visible": false}].That works fine.
Problem is that those hidden columns still appear in the popup when I click on "+". How can I prevent them from displaying there too?
Thanks in advance.

Replies

  • gorsstakgorsstak Posts: 3Questions: 0Answers: 0

    I found solution to this by checking if column title or column index meets my requirements eg. col.title == 'Index Number' or col.columnIndex == 3, only in that case I would add html to the details table like this:
    htmlForDetails = htmlForDetails +
    '<tr data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
    '<td>'+col.title+':'+'</td> '+
    '<td>'+col.data+'</td>'+
    '</tr>'

This discussion has been closed.