Distinguish whether edit oder duplicate button was clicked in preOpen event
Distinguish whether edit oder duplicate button was clicked in preOpen event
Hi,
in the editor.preOpen event I need to distinguish which button was clicked, edit button or duplicate button; both buttons show action "edit" and the mode "main" in the console although the duplicate-button has the mode "create" assigned ; how can I tell which button was clicked?
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: "selected",
text: 'Duplizieren',
action: function (e, dt, node, config) {
editor
.edit( wftable.rows( {selected: true} ).indexes(), {
title: 'Datensatz duplizieren',
buttons: 'neuen Datensatz speichern'
} )
.mode( 'create' );
}
Thanks in advance, martin
This question has an accepted answers - jump to answer
Answers
Here
https://datatables.net/forums/discussion/67137/editor-preopen-event
Allan wrote
Inside the action function for your duplicate button set a variable such as ignore. Then in your event handler check if that was set or not. If set, then reset it and exit.
How do I do this?
You would do something like this - it's just setting a variable,
duplicate
, in theaction
function which is then checked inpreOpen
,Colin
Thank you Colin