Programmatic way to select a row in a grid - (click the row

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
HowardA
Profound User
Posts: 29
Joined: Fri Feb 08, 2013 8:34 am
First Name: howard
Last Name: Arner
Company Name: Citco Sys
State / Province: Georgia
Country: United States
Contact:

Programmatic way to select a row in a grid - (click the row

Post by HowardA »

I want to use java script to click a particular row in a grid. Is that possible? (by programmatically clicking this row, it would perform the action that has been scripted in the onrowclick event).
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Programmatic way to select a row in a grid - (click the row

Post by Scott Klement »

At the moment, there is no good way to programmatically trigger the onrowclick event of a grid. (There are "hacks" that might work, but they may break in future versions of Profound UI, so I would not recommend them)

Here's an idea that might work, though... can you put your onrowclick logic into it's own function? For example, create a JavaScript file in userdata/custom/js and code something like this:

function myFunc() {
... move existing onrowclick logic here...
}

Then have the onrowclick event call myFunc().

Then, you could run the same function anywhere else you need it, just by calling myFunc() elsewhere in your code.
HowardA
Profound User
Posts: 29
Joined: Fri Feb 08, 2013 8:34 am
First Name: howard
Last Name: Arner
Company Name: Citco Sys
State / Province: Georgia
Country: United States
Contact:

Re: Programmatic way to select a row in a grid - (click the row

Post by HowardA »

Thanks Scott,
I was looking for an quick/easy way to deal with a specific issue I have with a grid. When calling the program that loads the display, a subfile is built, with several rows but the parameter passed into this program identifies one particular row of that subfile. when the subfile is displayed, I wanted to execute the onrowclick logic for that row (which relates the parm passed in, thus is not known until run time). I could put the logic in another function, but still need to launch it when the page is loaded, based on the appropriate row(from the passed in parm). (the logic being executed extracts a bunch of hidden subfile fields from the row using several of these statements:
changeElementValue("CSUNIT_A", get("CSUNIT." + row));

Thanks again for your assistance!
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Programmatic way to select a row in a grid - (click the row

Post by Scott Klement »

One approach might be to put a hidden numeric field on the screen, maybe the field would be named 'CLICKRRN' or something similar.

Put some Javascript code in your screen's "onload" event that retrieves the value of the hidden field, and if it's >0, call your function and pass the value of the CLICKRRN field as a parameter.

The "onrowclick" function would call the same function, and pass the row that the user clicked on as a parameter.
HowardA
Profound User
Posts: 29
Joined: Fri Feb 08, 2013 8:34 am
First Name: howard
Last Name: Arner
Company Name: Citco Sys
State / Province: Georgia
Country: United States
Contact:

Re: Programmatic way to select a row in a grid - (click the row

Post by HowardA »

That sounds like an easy way to go about it. I'll go that route, and thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest