Is it possible to submit two editor instance with one button?
Is it possible to submit two editor instance with one button?
Hi,
This code submits only editor2 instance. How can I submit both?
Thank you and best regards:
Endre, Szak
new $.fn.dataTable.Buttons(table2,
{
name: okbuttonname,
buttons:
[
{
extend: "selectedSingle",
editor: editor2,
text: okbuttonname,
action: function (e, dt, node, config)
{
var todayDate = new Date().toISOString().slice(0, 10);
editor1
.edit(table1.row({ selected: true }).index(), false)
.set('approve_gaf.status', okstatusname)
.submit();
editor2
.edit(table2.row({ selected: true }).index(), false)
.set('approve_gaf_flow.approve_tn', <?php print $_SESSION['pr_torzsszam']; ?>)
.set('approve_gaf_flow.approve_date', todayDate)
.submit();
}
}
]
});
This question has an accepted answers - jump to answer
Answers
I've never tried that I'm afraid, so it is a little bit undefined what would happen, but looking at it I don't immediately see why it wouldn't work. What you could do is put the submit for the second one in the success callback for the first so they aren't firing off at the same time:
Allan
Now neither 1 nor 2 is called.
It seems that because the button is assigned to table2, it refuses to call editor1.
I built a simple test case and Allan's code seems to work:
https://live.datatables.net/guwafemu/641/edit
Take a look at the browser's console for errors. If you still need help the please provide a link to a test case showing the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
editor: editor2,
won't actually do anything for aselectedSingle
button.selectedSingle
doesn't look at that property at all, so you can safely remove that line.Allan
Thank you Allan and Kevin,
A faulty editor1.dependent caused the problem. There was no else branch in it. I don't understand the connection, because the console didn't report an error, but since I fixed it, this button also works.
Thank you very much for your help!