This topic is locked

reload/update master row after details have been updated

2/3/2022 6:17:14 PM
PHPRunner General questions
M
m.dughera author

I have a list view of requests (master) and related events (detail):

img alt

the "Request status" and "Open candidates status" fields in the master table are a computed value (via a sql view).
Once a new event is entered, "Request status" and "Open candidates status" should be changed accordingly.
How can this be obtained?

  1. Is there a way to trigger the reload from DB of the master line from the detail events (i.e. after a new record is added)?
  2. if not possible, is there a way to access to the field in the page and mark it "outdated" so that the user is informed that the value in the master record is not valid anymore?
  3. I have been able to refresh the events part of the page calling pageObj.reload({}) in Javascript Onload event but this has impact only on the events of that specific Request

Maybe I am trying to force the application to do something that has not been designed to, but I read similar topics (although not applicable to my case) that show that updates to master data when details change are a common requirement.

ciao.

M
m.dughera author 2/4/2022

In the meantime since I published this post, I discovered that adding the code below to the add page of "events" reloads the page completely.
I'm not sure if this works in any condition and I am trying now to reopen the details page that is closed by the reload call.

function OnPageLoad(pageObj,pageid,proxy,row)
{
if( !pageObj.myAfterInline ) {
this.on('afterInlineAdd', function( fieldsData )
{
var master = pageObj.getMasterPage();
if( master )
{
master.reload();
}
} );
pageObj.myAfterInline = true;
}

M
m.dughera author 2/4/2022

From the documentation https://xlinesoft.com/phprunner/docs/how_to_control_inline_add_edit_functionality_from_script.htm

// get the list of record IDs
var recsId = pageObj.inlineEdit.getRecsId();

// use the actual details table name
var dTableName = 'events';
var dp = this.dpObjs[dTableName];
var row = dp.getRowById( recsId[X] ); <<<<<<<<<< how can I retrieve this X ?
dp.openDetailsTabs( row, $(null) );