JqGrid: can I know which action button is clicked in onSelectRow?

后端 未结 1 2000
忘掉有多难
忘掉有多难 2021-01-28 07:15

I have a grid. The first column is a checkbox for each row. The second column has two action buttons for each row: edit and delete. When a click on the edit button or delete but

1条回答
  •  迷失自我
    2021-01-28 08:02

    I don't sure that I understand full scenario which you are implementing. So I try to answer on your main question only: how one can detect inside of onSelectRow callback that the callback called because Delete button was clicked.

    You can use 3-d parameter of the onSelectRow. The corresponding code could be about the following:

    onSelectRow: function (rowid, status, e) {
        var $div = $(e.target).closest(".ui-pg-div");
        if ($div.hasClass("ui-inline-del") && $div.attr("id") === "jDeleteButton_" + rowid) {
            alert("Delete button was clicked");
        }// else if ($div.hasClass("ui-inline-edit") && $div.attr("id") === "jEditButton_" + rowid) {
        //    alert("Edit button was clicked");
        //}
    }
    

    0 讨论(0)
提交回复
热议问题