Andrus
Andrus

Reputation: 27953

How to force delete action button to call delete controller in jqgrid

jqGrid delete action button is used to delete row. This button click calls Edit method, it looks like it uses editurl parameter. How to force it to call Delete method like Delete toolbar button calls ?

$(function () {
            var grid = $("#grid");
            grid.jqGrid({
                url: '/GetData',
                colModel: [{ 
                "formatter":"actions",
                "formatoptions":{"keys":true,"delbutton":true,
                ...
               }}],
                editurl: '/Edit',
            });

          grid.navGrid("#grid_toppager", null,null,null, { url: '/Delete' } );
});

Upvotes: 2

Views: 4330

Answers (1)

Oleg
Oleg

Reputation: 221997

You should include delOptions option in the formatoptions:

formatter: "actions",
formatoptions: {
    keys: true,
    delbutton: true,
    delOptions: {
        url: "/Delete"
    }
}

Inside of delOptions you can use any from the properties and any events of the delGridRow method.

Upvotes: 7

Related Questions