How to add "edit" and "delete" buttons for each row while using the Editor plugin
How to add "edit" and "delete" buttons for each row while using the Editor plugin
lavapotato
Posts: 10Questions: 2Answers: 0
in Editor
I see this example: https://editor.datatables.net/examples/simple/inTableControls.html
BUT it doesn't seem to pertain to using the Editor plugin. As the table is controlled via the Editor plugin (how the instances are built) so not sure how to get around this.
Basically want...
- the table to look like the example link above in terms of each row having its own edit and delete link
- ability to make the links be actual buttons, so to be able to stylize them to my own liking (ie. using bootstrap which is setup)
Any help appreciated
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hello,
you can use the following code to get the new, edit and delete buttons on your table.
oTable = $('#example').DataTable( {
aButtons: [
{ sExtends: 'editor_create', editor: editor },
{ sExtends: 'editor_edit', editor: editor },
{ sExtends: 'editor_remove', editor: editor }, ]
}
} );
see example : https://editor.datatables.net/examples/simple/simple.html
Also there is an inline editor that you can activate
https://editor.datatables.net/examples/inline-editing/simple.html
It does in that it uses the Editor API. For example:
from the example you linked to calls the
edit()
method to trigger the editing of a row.In the example I've used
a
tags, but you could use anything you like, including buttons.Allan
Thanks for the help... I think I've got it working now!