Delete button in my datatable
Delete button in my datatable
bartdereu
Posts: 10Questions: 5Answers: 0
Hi All,
i'm having a datatable that is filled with JSON data. I want a delete button that submits a form with the user_id of that row.
is that even possible? I have been looking at code to delete, but ofcourse my data will be still around if i use that approach.
$(document).ready(function () {
$('#example').dataTable({
"paging" : false,
"processing": true,
"serverSide": false,
"ajax": "/myJSON_API",
"columns": [
{ "data": "Name" },
{ "data": "MemberType" },
{ "data": null, "className": "center", "defaultContent": '<a href="" class="editor_remove">Delete</a>' } ->> needs to be user_ID
]
});
});
Anyone that has a clue, Can't seem to find much on google :(
thanx allot !
This discussion has been closed.
Answers
//EDIT
I'm sorry. My answer is wrong and here's no option to delete post :)
If you are using Editor, this example shows how it might be done.
If you are not, use
columns.render
rather thancolumns.defaultContent
. therender
option can be given as a function to create dynamic content - thedefaultContent
is for static content only.Allan