add buttons to multiple tables
add buttons to multiple tables
montoyam
Posts: 568Questions: 136Answers: 5
I need to only show add/edit/delete buttons depending on the user permissions. I found the following post that seems will do the trick:
https://datatables.net/forums/discussion/comment/160764/#Comment_160764
however, I have multiple tables per page. Is there a way to add buttons multiple tables without hard coding the table names?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
You would need to hard code the names, as each table would have its own Editor instance.
Colin
but the buttons are added to the datatable instances, not the editors, right?
I think Colin is referring to this code to add the Editor buttons:
You need to provide the editor instance variable.
Kevin
ah, yes. I realized this as I was starting to add buttons. thanks.
I didn't realize you need to add each button separately (or if there is a way to add create, edit, delete in one command I couldn't figure it out). In my situation, it is either all or nothing with the buttons. they don't have the need to have only some users add, some only edit.
So, instead I did the inverse. All the buttons are created as normal, then:
That's one way of doing it - the other is to just not declare originally if that user doesn't have permission.
Colin
so you can put a function inside of buttons: [] ??
What is the syntax for this?
You could do something like this.
Colin
oh, this is much cleaner. Thanks.