I have a query with filters. I would like, if the customers filters only found 1 match to have the row selected. But if more than one match, to NOT have it selected. Is this possible. (The reason why, is that this is on a VP with a few other related queries and it takes about 2 seconds for all of them to be populated. I do not want to have the original query delayed by the 2 seconds.
Bruce
Can I have the top row in query selected if only 1 match?
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: Can I have the top row in query selected if only 1 match
Try this ...
Query Render Script
Query Render Script
Code: Select all
widget.bind("dataBound", function(e) {
if (widget.items().length === 1) {
widget.select("tr:eq(0)");
})
}
Last edited by johntalbott on Tue Jan 14, 2020 12:28 am, edited 1 time in total.
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
Good news, bad news John
The good news, it DOES select it (after I add a ")" to the end that was missing.
The bad news is that Aware doesn't know it so it does NOT trigger the default event when clicking on the row.
Bruce
The bad news is that Aware doesn't know it so it does NOT trigger the default event when clicking on the row.
Bruce
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Can I have the top row in query selected if only 1 match
The clunky way to do it is to have two different but almost identical queries and call them from a process.
If the find count is =1 then show the query that has the first row select, if the count>1 then show the query that does not have any rows selected.
Downside is that there are redundant queries that require additional maintenance.
If the find count is =1 then show the query that has the first row select, if the count>1 then show the query that does not have any rows selected.
Downside is that there are redundant queries that require additional maintenance.
-
- Posts: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: Can I have the top row in query selected if only 1 match
Are you saying that even when you physically click the row it doesn't work?
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: 619
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: Can I have the top row in query selected if only 1 match
This should do the trick ...
Query Render Script
With this approach, you might not need this line:
Query Render Script
Code: Select all
widget.bind("dataBound", function (e) {
if (widget.items().length === 1) {
widget.select("tr:eq(0)")
parser.onTableClick("tr:eq(0)", widget)
}
})
Code: Select all
widget.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
You are a (smart) gentleman and scholar
This works just fine.
Thanks
Bruce
Thanks
Bruce