-2

In free jqgrid inline edit of row is started using single click in row in beforeSelectRow event.

So inline edit button in actions column is not needed. I tried to remove it by setting editbutton = false in formatoptions:

  cm= [{
    "name":"_actions",
    "template":"actions",
    "formatoptions":{"editbutton":false,
    "delbutton":true,
    "delOptions":{"url":"Delete",
    "afterComplete":function (response, postdata, formid) { 
       $grid[0].focus(); 
       }
      }}}

In this case save and cancel buttons also do not appear in actions column during inline edit. Actions column is empty on inline edit.

How to enable save and cancel action buttons if edit action button is disabled ?

Andrus
  • 26,339
  • 60
  • 204
  • 378

1 Answers1

2

I suppose that you mean that Save, button should be included in formatter: "action", but be hidden till the editing will be started in the line (by usage button of inlineNav, by selection of the row or by some other way). You can do this in free jqGrid by usage isDisplayButtons callback (see the answer). The following definition of the column do the trick

{
    name: "_actions",
    template: "actions",
    formatoptions: {
        editbutton: false,
        isDisplayButtons: function (opts, rwd, act) {
            return {
                save: { display: true },
                cancel: { display: true }
            };
        }
    }
}

See the demo:

enter image description here

In general you can display visible Save button in all rows by usage of

{
    name: "_actions",
    template: "actions",
    formatoptions: {
        editbutton: false,
        isDisplayButtons: function (opts, rwd, act) {
            return {
                save: { display: true, hidden: false },
                cancel: { display: true }
            };
        }
    }
}

(see the next demo), but the Save buttons will be hidden after editing saving of the row changes because formatter: "actions" synchronize the visibility of buttons with the current state of the row:

enter image description here

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798