AnonyMouse
AnonyMouse

Reputation: 18650

jqgrid inline editing methods

This link has:

editRow

Calling conventions:

jQuery("#grid_id").editRow(rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);

or when we use the new API

jQuery("#grid_id").jqGrid('editRow',rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);

I understand this one:

jQuery("#grid_id").editRow(rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);

Is an actual call to edit the row with row id rowid. So it actually puts the row into edit mode.

In my jqgrid it is setup so that each row has a pencil icon beside it and you click it to edit the row"

enter image description here

So obviously I'm not manually calling that method to edit the row but the edit pencil click is automatically calling edit.

What I'm wanting to set up is so that after editing you click the save icon and I want it so after you save a method is called namely:

function reload(rowid, result) {
            alert("Hi");
                $("#list").trigger("reloadGrid"); 
            }

So I was thinking of using the code they specified for use with the new API:

jQuery("#grid_id").jqGrid('editRow',rowid, keys, '', reload);

I'm not sure how this works but I put this after my grid. I understand it is not a method call but setting it up to tell it what to do for when an editRow occurs.

Well it doesn't work.

Could someone tell me have I misinterpreted what that code actually does? If so what does it do? Also how to achieve the method call after submit for my scenario?

Upvotes: 0

Views: 4482

Answers (1)

Oleg
Oleg

Reputation: 222007

If I understand you correctly, you should use aftersavefunc and not succesfunc parameter of editRow.

If you use formatter: 'actions' then you should use afterSave property of the formatoptions. I recommend you to look at the answer which was my first experience of the formatter: 'actions' and where the comments in the code gives some additional advise.

Upvotes: 1

Related Questions