Get parent rowid from subgrid for use in Add editoptions

Dec 2, 2013 at 6:34 AM
Is there a "best practice" way to obtain a parent rowid from a subgrid so that I can pass it to my web service method when adding rows in a subgrid?

I am using the "subgrid as grid" approach with a "subgridHelper" defined.

In pseudo-code, I'd like to pass extra data along with the Add request like "{ParentId: parenttableId}".

If there is something builtin to help achieve this what is it?

If not what is the best way to go about achieving this sort of thing?

I would imagine it is fairly common for people to need a parameter from the parent when adding to the child.
Coordinator
Dec 2, 2013 at 10:42 AM
Hi,

There is a client side variable rowId accessible through JavaScript, you can read more about it here.

Regards,
Tomasz Pęczek
Dec 3, 2013 at 11:37 PM
Is the rowId something that is set by jqGrid to the PK or something I need to set myself, say, on the expand Grid event?
Coordinator
Dec 4, 2013 at 8:23 AM
Hi,

The rowId is helper specific amd it will be set to correct value by helper (helper is using this variable also - in order to send the id to the action method).

Regards,
Tomasz Pęczek