Mir Gulam Sarwar
Mir Gulam Sarwar

Reputation: 2648

do not show the Edit form using beforeShowForm function jqgrid

I have the following code

editOptions: {
    beforeShowForm: function () {
        var myGrid = $('#list'),
        selRowId = myGrid.jqGrid('getGridParam', 'selrow'),
        IsIssued = myGrid.jqGrid('getCell', selRowId, 'Status');
        // alert(IsIssued);
        if (IsIssued == 'true') {
            alert("asd")
            return [false];
        }
        else
            return [true, "ll"];
    },

I want that if the

(IsIssued == 'true')

then do not show the Edit Form. Is it possible? Because it is always showing me the Edit form.

Upvotes: 0

Views: 3590

Answers (1)

Oleg
Oleg

Reputation: 221997

The answer describes how you can close Add/Edit form directly after it will be opened. You can use either beforeShowForm or afterShowForm in the same way because both have no direct way to deny opening of the form.

In my opinion you should consider other options which could be more understandable from the point of view of the user. You can disable Edit button of the navigator bar on selection of rows which should be not editing. The demo from the old answer demonstrates the approach. Alternatively you can hide Edit button on selection of the rows which should be non-editable. The demo from the answer demonstrates this.

Upvotes: 2

Related Questions