Perform action if row is the first on a data list

nando.lucas shared this question 3 years ago
Answered

Hi,


I have two data grids. The first one (Source) has items that can be selected through checkboxes. The selection from that Source data grid is passed on in a variable to another data grid (Target) in another screen, so Target is populated by the selected items in Source.


I want to perform a few style changes ONLY to the first row for the Target data grid.


How do I select only the first row in the Target data grid, no matter what its contents are? Or, how do I achieve this in any other way?


Basically that I needed was something like If [Row index of [ Target ] == 1]

Comments (3)

photo
1

You could probably use a hidden column to do this.


Something like the following.


1. Create a variable called row_index with a default value of zero.


2. Add a new column to your data grid.


3. In the first non-header row (where the logic is) put a text widget. You can put anything in there as we'll replace the value on page load.


4. On that text widget add an on page load, set value event that is basically row_index = row_index + 1;


5. Add another on page load, set value event on that text widget that updates the value of the text widget to the value of row_index.


6. Add a new interaction with another on page load, set value event that changes the style as desired.


7. Add a condition to the interaction that when page_index = 1 perform that action.


8. Make the column with zero, which effectively hides the column from the user. The column is still actually loaded so you can use it for actions.


Here's a few screenshots of how I did it.


1. New column with actions -> http://www.screencast.com/t/LXezkg74


2. Results -> http://www.screencast.com/t/BGwTiKXzBULi

photo
1

Thank you very much!

photo
1

Can someone please upload a vp file with an example?The screenshots didn't help very much...