delete without confirmation

delete without confirmation

OlanOlan Posts: 41Questions: 11Answers: 1

I want to delete a selected row with a button without a confirmation popup. My code so far is:

{ sExtends: "select_single",
    sButtonText: "Remove",
    fnClick: function ( button, config ) {
        var rows = table.rows( '.selected' );
        rows.delete();
        }
},

but now a confirmation popup appears. Is it possible to delete the selected row without any confirmation?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    What you would need to do is use the remove() method rather than row().delete(). The reason being is that row().delete() doesn't provide an option to not show the Editor form (an oversight on my part that I will fix).

    So you might do something like editor.remove( table.rows('.selected').indexes(), false ).submit();.

    Allan

  • OlanOlan Posts: 41Questions: 11Answers: 1

    Great! Works like a charm!

  • com6temcom6tem Posts: 11Questions: 4Answers: 0

    Hi Allan,

    I have exactly the same need as Olan, but can I use the piece of code you provided within a RESTful Editor interface like:

    remove: {
                    type: 'DELETE',
                    url:  '../php/rest/remove.php?id=_id_'
                }
    
  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Yes. Keep in mind that if multiple ids are submitted they will be comma separated - your API might or might not allow for that.

    Allan

This discussion has been closed.