I have a grid that has a button that opens another (target) grid that I use to lookup values, make and save edits.
The two grids are linked and filtered so that only the current record is opened in the target grid.
I use the following to lookup values in the target grid and set values back into the parent grid.
//Get a pointer to the parent component object that opened this grid.
var po = {grid.Object}.getParentObject();
//Get the values from the grid (you can define as many as you like)
var firstname = {grid.object}.getValue('G','first_name',{grid.rowNumber}); //golfer table
var lastname = {grid.object}.getValue('G','last_name',{grid.rowNumber}); //golfer table
var city = {grid.object}.getValue('G','city',{grid.rowNumber}); //golfer table
var cellphone = {grid.object}.getValue('G','last_name',{grid.rowNumber}); //golfer table
var notify = {grid.object}.getValue('G','notify',{grid.rowNumber}); //golfer table
//If this Grid does not have a parent then 'po' will be false.
if (po) {
po.setValue('first_name',firstname); //golfer table
po.setValue('last_name',lastname); //golfer table
po.setValue('city',city); //golfer table
po.setValue('cellphone',cellphone); //golfer table
po.setValue('notify',notify); //golfer table
}
//Close the grid.
{grid.Object}.closeContainerWindow(this);
Works perfectly!
When I add another field from the golfer
The two grids are linked and filtered so that only the current record is opened in the target grid.
I use the following to lookup values in the target grid and set values back into the parent grid.
//Get a pointer to the parent component object that opened this grid.
var po = {grid.Object}.getParentObject();
//Get the values from the grid (you can define as many as you like)
var firstname = {grid.object}.getValue('G','first_name',{grid.rowNumber}); //golfer table
var lastname = {grid.object}.getValue('G','last_name',{grid.rowNumber}); //golfer table
var city = {grid.object}.getValue('G','city',{grid.rowNumber}); //golfer table
var cellphone = {grid.object}.getValue('G','last_name',{grid.rowNumber}); //golfer table
var notify = {grid.object}.getValue('G','notify',{grid.rowNumber}); //golfer table
//If this Grid does not have a parent then 'po' will be false.
if (po) {
po.setValue('first_name',firstname); //golfer table
po.setValue('last_name',lastname); //golfer table
po.setValue('city',city); //golfer table
po.setValue('cellphone',cellphone); //golfer table
po.setValue('notify',notify); //golfer table
}
//Close the grid.
{grid.Object}.closeContainerWindow(this);
Works perfectly!
When I add another field from the golfer
Comment