Issue
I need to change the text color of an element (widget) based on the value of another field in my app. Specifically, I want to change the color of the User ID label to red if the user's status is suspended. However, I am unable to add an ID to the widget, so I'm not sure how to target it in my code. I tried using a separate query to retrieve the user details, but it caused issues when clicking on the same cell twice. I asked for assistance and was provided a solution using the selectedRow function to change the text color based on the status field value. The solution worked well for me.
Resolution
The user wants to change the text color of an ID label in a detailed view section based on the value of a hidden field called "Status". Initially, it was suggested to use widget names as IDs, since they are unique, but it was not possible to add an ID to a widget.
Therefore, a solution was proposed using the selectedRow.columnName syntax to refer to values of a column from the selected row in a table. The solution involved creating a POC that changed the text color of the ID label based on the value of "Status". The user then adapted the solution to their use case by using a separate query to retrieve the user details based on the selected row ID. The final solution involved using the {{ get_client.data[0].client_id }} syntax to retrieve the text value and using the conditional statement {{ members.selectedRow.status == “Pending” ? ‘Red’ : ‘Black’ }} in the Text Color JS field to change the color of the ID label.