How to hide a button
How to hide a button
INTONE
Posts: 153Questions: 58Answers: 6
I have read in the docs that I can call a fnInit on a tabletools button but I don't know how to show/hide button as needed. Here is my code:
aButtons: [
{ sExtends: "editor_create" ,
editor: editor ,
"fnInit": function ( nButton, oConfig ) {
//check if this user has the right to see/use the button to create new record
if(S(session({"id":1}).select("write_user_roles")).toString() == "No"){
//some code to hide the button
} else {
//some code to show the button
}
}
},
{ sExtends: "editor_edit" ,editor: editor },
{ sExtends: "editor_remove" ,editor: editor },
{ sExtends: "select_none" ,editor: editor }
]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
There isn't currently an API to show / hide a button in TableTools. It can be done by setting the DOM visibility of the button, but I would suggest that you simply don't add the create button tot he array if the user doesn't have access.
Allan