Delete button in my datatable

Delete button in my datatable

bartdereubartdereu Posts: 10Questions: 5Answers: 0
edited July 2015 in Free community support

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 !

Answers

  • neurofunkneurofunk Posts: 14Questions: 5Answers: 1
    edited July 2015

    //EDIT
    I'm sorry. My answer is wrong and here's no option to delete post :)

  • allanallan Posts: 63,132Questions: 1Answers: 10,398 Site admin

    If you are using Editor, this example shows how it might be done.

    If you are not, use columns.render rather than columns.defaultContent. the render option can be given as a function to create dynamic content - the defaultContent is for static content only.

    Allan

This discussion has been closed.