How to remove a remove-extended button
How to remove a remove-extended button
Hello,
I am trying to remove programmatically this type of buttons (during its own init method) like that:
{
extend: 'remove',
name: 'deleteParticipant',
init: function ( dt, node, config ) {
switch(profile) {
case 'Student':
case 'Staff':
table.button('deleteParticipant:name').remove(); // not working!
break;
default: //Admin
//alert('No way!');
}
},
editor: editor,
formButtons: [
'Delete',
{ text: 'Cancel', action: function () { this.close(); } }
]
}
Removing create-extended buttons this way is working well...
Thanks!
This discussion has been closed.
Replies
Hi @ka107 ,
That seems like an odd thing to do. Can you give some context please as to the problem you're trying to solve so we can get a better understanding.
Cheers,
Colin
depending of the profile from the logged in user, I would like to remove some buttons.
In this case, I don't want students and staff to have access to the 'Delete' button (disabling is working fine but I'd prefer removing that buttons)
It's weird that the same thing is working right for the rest of the buttons but not for this
Hi @ka107 ,
I tried it, and it gives an error - not too surprising I guess given it's removing itself in its own function. If you want to use
button().remove()
, it would be better to do this ininitComplete
. Alternatively, you can justbutton().disable()
it and hide it within thebuttons.buttons.init
- like this here: http://live.datatables.net/ritolure/1/editCheers,
Colin
thanks for the info, finally I realized its better to do at initComplete