Adding custom button group
Adding custom button group

I would like to add a group of custom buttons on the far left side of the table (New, Edit and Delete). I would like the built in buttons (Copy, CSV, Excel, etc.) to simply scoot over so I would have two groups of buttons side by side. I cannot figure out how to have both groups on the table. Or even the correct location to include my code for the custom buttons so that both button groups appear on the table.
I have received an error : DataTables warning: table id={id} - Cannot reinitialise DataTable.
Then, I can see my custom buttons on the table but not the built in ones anymore. I haven't found a clear answer anywhere for this specific situation.
Additionally, is it possible to **hide ** any button until at least one row is selected? I've found how to disable a button but not how to make it invisible.
Any help is much appreciated!
Answers
The error has a link to information of how to resolve the error. Have you followed the steps in the link?
https://datatables.net/manual/tech-notes/3
Sounds like you are trying to initialize Datatables more than once with different buttons options. Instead of this you will want to combine all the options into one initialization code.
Minimally please post your code so we can see how you are trying to setup the buttons. Better option is to provide a link to your page or a test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
You can use the
button().remove()
API to remove the button thenbutton().add()
to place the button on the page when rows are selected.Kevin