hide column [data: {}] with conditional?
hide column [data: {}] with conditional?
cris19n
Posts: 55Questions: 18Answers: 0
let user=$('#user').val();
"columns": [
//{ data: 0 },
{ data: 1 },
{ data: 2 },
//here how can I do something like that?
if(user=='admin'){
{
"render" function ( data, type, row ) {
}
}
}else{
//If you do not comply, do nothing.
}
]
How can I do something like this?
what I want is that if the user is an administrator,
Show me the action buttons.
if it is another user it does not show anything.
thanks for the answers
This discussion has been closed.
Replies
IF you want to hide the whole column if not an admin then use
column.visible
, something like this:Otherwise if you want to show the column but no button then put you if statement inside the
columns.render
function, like this:Kevin
thanks @kthorngren , I had more or less the idea with visible property, I was injecting everything into a function.
Thank you so much