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?
[broken in 8.6] JS To Select First Row
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
[broken in 8.6] JS To Select First Row
Last edited by PointsWell on Sat Jun 19, 2021 2:07 pm, edited 4 times in total.
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: JS To Select First Row
In the dataBound event of the Child grid you can do this.
In Render Script of child grid
In Render Script of child grid
Code: Select all
widget.bind("dataBound", function(e){
const grid = e.sender
grid.select("tr:eq(0)");
})
VocalDay Solutions - Agility - Predictability - Quality
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: JS To Select First Row
Thanks, that keeps it highlighted but it isn't triggering the default operation to make the details grid update.johntalbott wrote:In the dataBound event of the Child grid you can do this.
In Render Script of child grid
Code: Select all
widget.bind("dataBound", function(e){ const grid = e.sender grid.select("tr:eq(0)"); })
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: JS To Select First Row
Code: Select all
widget.bind("dataBound", function(e){
const grid = e.sender;
grid.select("tr:eq(0)");
grid.select().click();
})
VocalDay Solutions - Agility - Predictability - Quality
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: JS To Select First Row
Perfect! Thank you very much John.
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: JS To Select First Row
So, I was a little previous on my perfect...PointsWell wrote:Perfect! Thank you very much John.
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. 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.
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
The Conditions
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.
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.
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: [Solved-with Conditions] JS To Select First Row
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.
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.
VocalDay Solutions - Agility - Predictability - Quality
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: [Solved-with Conditions] JS To Select First Row
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: [Solved-with Conditions] JS To Select First Row
Can confirm that this no longer works with v8.6 where was working previously.