2
votes

I would like to get confirmation before displaying(open) the popup editor when click on edit command button in the kendo grid same as delete confirmation.

I have used Edit event of the grid. It is successfully display the confirmation dialogue but behind it opens the popup editor window as well.

Is there any way I can display popup editor window only after confirmation from user?

1

1 Answers

1
votes

You can use the editRow() method. Documentation.

HTML:

<div id="container">
    <div id="grid"></div>
</div>

JavaScript:

var data = [{"FirstName": "Margaret", "LastName": "Peacock"},{"FirstName": "Nancy", "LastName": "Leverling"}];
var grid = $("#grid").kendoGrid({
    dataSource: {
        pageSize: 20,
        data: data
    },
    editable: "popup",
    pageable: true,
    height: 550,
    columns: [
        { field: "FirstName", title: "First Name", width: "140px" },
        { field: "LastName", title: "Last Name", width: "140px" },
        { command: { text: "Edit", click: edit }, title: "", width: "180px"}
    ]
}).data("kendoGrid");

function edit(e) {
    e.preventDefault();
    var conf = confirm("Are you sure you want to edit?");
    if (conf) {
        this.editRow($(e.currentTarget).closest("tr"));
    }
}

See demo