How do you set an onpageload event to cause a change in style of a specific row of a datagrid?

Christopher Davies shared this question 5 years ago
Answered

If you have a datagrid and you want the style (background colour, font colour) of a specific row to change on page load, subject to some criteria, how would you do this? The key is addressing the specific row I guess. I have made a simple example here where the entries in the grid under name are '1', '2', '3' and the entries under status are 'a', 'b', 'c'. In this example I want the first row to turn red as it has the status 'a' in it. Is this possible?


4ad1461b0bbbc42bb1587a5753588da4

Comments (5)

photo
1

Here is how you do it. 1b4b7707731f8fccc0a18464886218a5

photo
1

great! Thanks John!


I knew there had to be a simple answer

photo
1

actually, that second picture is no use - I can't see which things are selected and the last 2 boxes look identical. Can you take screen grabs where everything is labelled please?

photo
1

Assuming you already have a data master with Name and Status data fields already filled (just like what you have above).


1. right click on the data grid -> edit content


2. select the second row of the data grid -> Add event -> on Page Load


For the condition, look at 'a.png.' You have to create the expression in that image.


- drag and drop 'Select' function under Collections tab


- drag and drop 'Row_1' to the first field under Screens tab


- drag and drop 'Status' field under Data Masters tab


- drag and drop 'has' function under text tab


- double click the last field and enter letter 'a'


click OK


3. To change the background color of that specific row, click change style -> select the second row of the data grid, 'Row_1' -> check background -> change background color to red


4. To change the font color of that row. Look at 'b.png'


- on the same on Page Load event, click the drop down menu next to 'do' -> click Add action -> Change Style -> select [test.Name] on the data grid -> click Text checkbox -> then change the font -> click OK


- do the same for [test.Status]


You can learn how to build complex expressions in our help and tutorials sections:


http://www.justinmind.com/help/index....


http://www.justinmind.com/prototyper/...


d5e966bb85dc3ded07844f3797372078

photo
1

ah ok thanks! got it working now