If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#52707 by BLOMASKY
Fri Jan 10, 2020 10:00 pm
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
#52709 by johntalbott
Sat Jan 11, 2020 2:43 am
Try this ...

Query Render Script

Code: Select allwidget.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.
#52725 by BLOMASKY
Mon Jan 13, 2020 7:55 pm
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
#52726 by PointsWell
Mon Jan 13, 2020 8:26 pm
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.
#52727 by johntalbott
Mon Jan 13, 2020 9:59 pm
Are you saying that even when you physically click the row it doesn't work?
#52730 by johntalbott
Tue Jan 14, 2020 1:48 am
This should do the trick ...

Query Render Script

Code: Select allwidget.bind("dataBound", function (e) {
   if (widget.items().length === 1) {
      widget.select("tr:eq(0)")
      parser.onTableClick("tr:eq(0)", widget)
   }
})


With this approach, you might not need this line:

Code: Select allwidget.select("tr:eq(0)")

Who is online

Users browsing this forum: Google [Bot], PointsWell and 30 guests