cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 2.0: How to "Scroll" highlight to a row in table by a given name?

Former Member
0 Kudos


Hi Personas 2.0 experts,

Assume that I run a tocde to get a table below shown on UI. Please be aware that the number of rows are not fixed, so there could be more or less rows added/removed in the table from time to time depending on the backend actions.

Type        Id            Text

A              2             Note-A

B              4             Note-B

C              1             Note-C

Here are what I want to do:

Case: Press a button, I want to see the row content of a given Type (eg C): ie "C  1   Note-C"

Solution proposal:

    I can first find the row index (I have no problem for this, in this example, it will be 3), then use "Scroll Vertically" action for the table object to move the "highlight" to the given row in the table, ie row 3.

    Problem: how can I scroll the highlight to a given row using JS in a script button?

Thanks very much in advance!

Dong Zhu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Just to close this thread, I'd like to add some "hack" solution to share with:

For this specific problem, one of my thought is to create multiple buttons each to select one of the items in the table. In JS code, Copy Table into an array and do search to match the item by content to find the position of the item in the table, then call the corresponding button to select the item.

This is good for a table with fixed number of items, and the item wanted can be placed at any position. But it is not good if the table contains dynamic number of items.

I closed this thread.

Br,


Dong Zhu

Answers (1)

Answers (1)

Former Member
0 Kudos

In Personas 2 the JavaScript can't interact with the GUI, so the simple answer is that you can't. And since there's no looping in the native Personas 2 scripting, you can't do it any other way either.

You're going to need to wait for Personas 3 for this, I'm afraid...

Steve.

Former Member
0 Kudos

Hi Steve,

Thanks for your quick reply.

It is very hard as the row index is "hard coded" like /rowcol/row[n] which cannot be changed dynamically. I am wondering what the script action "Scroll Vertically" does in script button then? According to the description it moves the contents across rows with rows being static.

If so, can't I just simply "move" the contents up by scrolling, until the content of "C" stays at row 1, then I can select the row 1, and press the Run button. Wouldn't this work?

Thanks.

Dong

Former Member
0 Kudos

The trouble is with the "until" part. There's no looping in Personas 2 scripting.

Steve.

Former Member
0 Kudos

Hi Steve,

You are right - no loop. But "Scroll Vertically" uses a parameter "Position" which has a value. So I can first CopyTable to an array, then in JS, I manually loop the array to find the "C" string, then I will know the index difference, say 2. By now, I can use "Scroll Vertically" to "Position" 2. I tried this, but for unknown reason, it did not show any content scrolling effect. Do you happen to know why? Thanks.

Dong

Former Member
0 Kudos

Ah, right. I've never used the scrolling action so wasn't sure how it worked. But that also means I don't think I can help any further without trying it out myself. Give me some time to experiment and I'll get back to you:-)

Steve.

Former Member
0 Kudos

Thanks.  Nice weekend!

Dong