Custom buttons
Custom buttons
Murray
Posts: 20Questions: 7Answers: 0
I use
columns: [
{ title: "Id" },
{ title: "First name" },
{ title: "Last name" },
{ title: "Email" },
{ title: "Phone" },
{ title: "Mobile" },
{ title: "", "defaultContent": "<button onclick='edituser();'>Edit</button>" },
{ title: "", "defaultContent": "<button onclick='deleteuser();'>Delete</button>" },
],
to add 2 custom buttons to the table. They both work, however, if I click on the Edit button, complete editing then click on the Delete button, I get the edit screen again. If I click on the Delete button before the Edit, I get the correct Delete screen. What do I need to add to sort this out please.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If this using Editor, or another way of editing the table?
Colin
The Edit button runs this javascript function which calls my own edit screen.
Probably will need to see the code in action to help debug. Please post a link to your page or a test case replicating the issue so we can understand the code flow.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Problem resolved by coding thus:
{ title: "", "defaultContent": "<button class=\"view\">View Tests</button><button class=\"test\">Run Test</button><button class=\"edit\">Edit</button><button class=\"delete\">Delete</button><button class=\"addtest\">Add Test</button>" },
although these buttons then do not work when pushed onto a lower row on screen resizing. I have asked a new question in that regard.
Thank you for looking at this.