How do I cancel modal opening in Delete?

How do I cancel modal opening in Delete?

gunseligunseli Posts: 14Questions: 8Answers: 0
edited September 2019 in Free community support

When deleting the line, I do not want the modal to open as in the picture below. How do I delete a row directly when I click on it?

table.row(idx).delete({
buttons: [ ],
});

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @gunseli ,

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

  • gunseligunseli Posts: 14Questions: 8Answers: 0

    Hi @colin, thank you your answer.

    But I don't want to use editor.remove, I want use to row().delete(). Because I'm deleting on a different page

       $.ajax({
                                type: "POST",
                                url: '@Url.Action("Remove")',
                                data: { 'lineitemid': clicked_id },
                                dataType: "json",
                                traditional: true,
                                success: function (data) {
                                    swal({
                                        title: "Success!",
                                        text: "Item Deleted...",
                                        type: "success",
                                    });
    
    
                                    var table = $('#items' + rfqid).DataTable();
    
    
                                    table.row(idx).delete({
    
                                    }
    
                                    );
                                      table.order([3, 'asc']).draw();
                                },
                                error: function(data) {
    
                                }
                            });
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @gunseli ,

    row().remove() will only remove the row from the local table - it won't update the remote source. I/m not clear what you're trying to do, could you give some more details, please.

    Also, are you able to link to your page or create a test case? Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

    Cheers,

    Colin

  • gunseligunseli Posts: 14Questions: 8Answers: 0

    Hi @colin,

    Thank you, I did the following way.

    $.ajax({
               type: "POST",
                url: '@Url.Action("Remove")',
                data: { 'lineitemid': clicked_id },
                dataType: "json",
                traditional: true,
                success: function (data) {
    
    
                           swal({
                           title: "Success!",
                            text: "Item Deleted...",
                            type: "success",
                                    });
    
            var  editor = new $.fn.dataTable.Editor({
                ajax: "/TechnicalPricing/LineItemsTable/" + rfqid,
                table: "#items"+rfqid,
                fields: [
                    {
                        label: "Id",
                        name: "LineItems.Id"
                    },
                    {
                        label: "Number",
                        name: "LineItems.Number"
                    },
    
                ]
            });
           var table = $('#items' + rfqid).DataTable();
    
    
             editor.remove(table.rows(idx), false).submit();
    
                table.order([3, 'asc']).draw();
                                },
                                error: function(data) {
    
                                }
                            });
    
This discussion has been closed.