简体   繁体   中英

Return a Value from jQgrid EditURL

I have a jqgrid with ajax data that for editing I have choose inline edit with some editURl that pointed to a webService.

It works fine but how can I have a return value then .

I mean after edit, how can I send some value to the page ???

Thanx

I've only just come across this question, and I was hoping you had the answer :) But I worked it out myself and can now give you an answer to solve this.

You can use the successfunc event attached to the jqGrid('saveRow', ...) call.

Assume in your controller where you have implemented the editURL for your jqGrid you return a JSON object (this is in MVC4):

JsonResult retVal = Json(new { someArray, someProperty });
return retVal;

Now in your call to save the row in jQuery, you can access those JSON properties:

$("#OrgUnitTableGrid").jqGrid('saveRow', lastSel, 
    {
    successfunc: function (response) {
        var data = JSON.parse(response.responseText);
        var thisArray = data.someArray;
        var thisProperty = data.someProperty;
        return true;
    }
});

Hope this helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM