As an example, I have a Master\Detail grid.
Master\Detail defined as
key-relation
model and ongetDetailRowData
method parent node data exists inparams
but how to get parent node data from child view?
Tried via context-menu:
On right click - getContextMenuItems
got executed which has an input params
On this sample, child-grid doesn't have any row and node
in context-params is null, it's ok,
but anyway it should be possible to retrieve the parent details at least via grid API, isn't it ?
Then I've tried to get parent
via node:
but instead of
detail_173
as you can see its ROOT_NODE_ID
, and here is a confusion for me.
So question is that how to get parent node data (RecordID 173 just in case) through child-view context menu or any other possible way (without storing temp value, cuz multiple children's could be opened at the same time)
Yes, I've read this part Accessing Detail Grid API, and still unclear how to get parent-node via child-grid.
A very reliable solution is to create your own detailCellRenderer.
on the init
method:
this.masterNode = params.node.parent;
when creating the detail grid:
detailGridOptions = {
...
onCellClicked: params => console.log(this.masterNode.data)
}
Here is a plunker demonstrating this: https://next.plnkr.co/edit/8EIHpxQnlxsqe7EO