The Problem:
I have multiple levels of Master Detail grids

Parent drives Child drives Details
The Child grid has a default action which populates the Details grid. The Child grid refreshes when a record on the Parent is selected (via a process which updates an ID field on LIRU).

The challenge is that when the Child grid refreshes the Select first row option is then ignored, which results in the no record being selected which prevents the default action on the Child grid refreshing the Details grid.

The question
Is there JS that I can add to force the selection of the first record in the Child grid?

In the dataBound event of the Child grid you can do this.

In Render Script of child grid

widget.bind("dataBound", function(e){
      const grid = e.sender
     grid.select("tr:eq(0)");
})
johntalbott wrote

In the dataBound event of the Child grid you can do this.

In Render Script of child grid

widget.bind("dataBound", function(e){
      const grid = e.sender
     grid.select("tr:eq(0)");
})

Thanks, that keeps it highlighted but it isn't triggering the default operation to make the details grid update.

widget.bind("dataBound", function(e){
      const grid = e.sender;
     grid.select("tr:eq(0)");
     grid.select().click();
})
PointsWell wrote

Perfect! Thank you very much John.

So, I was a little previous on my perfect...

2 follow up questions:

1 - The JS route doesn't play nicely with a grid that has a grouping on it, it appears to be selecting the unformatted query row, you can see the highlighted row between the row of data and the row acting as the grouping.
Screen Shot 2020-05-04 at 10.35.10.png

2 - Is there a way to trigger another process if there is no records returned as the target panel is a receiver rather than a listener so doesn't know the state of the query only what it is told - eg display this record, but if there is no record it doesn't get the trigger to refresh.

If you use the render script and have a default operation on record which starts a process (as opposed to a simple View Object) you will create an infinite loop.

It appears that the Start Process causes the grid to refresh which then triggers the render script, which starts the process, which triggers the render script... you see where this is going.

Some clarification on the code ...

The render script runs once when the grid is initially rendered. It won't run again unless the container of the grid is refreshed. e.g. refreshing your browser.

Having said that, when the render script runs the single time, the JS code "sets up" an event handler for the dataBound event of the grid that fires every time data is loaded into the grid even if that's zero records.

One way or another, what you want can be accomplished. It will take being able to see your specific configuration and use case.

a year later
16 days later

Can confirm that this no longer works with v8.6 where was working previously.