Perspective table dynamic icons and rows colors

Hi,
I want to create a table that displays for each row a description, a number binded to a tag and an icons that represent a boolean tag.
Based on the state of the tag the icon should be visible or not and the row should change color.
To be more specific for each row I have the name of station, the most important tag for that station and alarm bell (material/notifications) that should appear if a certain tag goes to 1.
In this post Icon in Perspective Table Column I saw that to include icons inside a table you should use a View and i managed to do that, the problem is that I can’t see how I can bind the ViewPath for each row. How can I do it?
Also, is it possible to change the color of a single row as described above?
Thanks
Daniele

You’ll need to set up your data so that it contains the following structure for each row:

{
    "stationName": "MyStationOne",
    "tagPath": "[provider]SomePath/MyTag",
    "displayAlarm": "[provider]SomePath/MyTag"
}

In this data, the displayAlarm uses the same string tag path as tagPath, but the View itself will be responsible for determining if the icon should be shown.

You then need to set up a column configuration for each column you want in your table, and you need to make sure that the field property of each column configuration matches the keys in the row data.
Screen Shot 2021-03-19 at 10.38.48AM

The important part is selecting that the column should render a view and supplying the path to the View (note the setting of the render property and the viewPath property):
Screen Shot 2021-03-19 at 10.39.50AM

For changing the color of rows based on some value, please see this post: Changing colour of row based off value in cell in perspective table - #17 by cmallonee

1 Like

Hi,
with you method I was able to set a single icon for every row in the table, what I’m trying to achieve is to control if the icon is visibile or not for each row.
On the left is what I have now and on the right is what i’m trying to achieve if, for example, “GRUPPO 4” and “GRUPPO 11” have an alarm going on.


Thanks for you help

Daniele

The View which is being rendered should determine if the icon is displayed or not based on the incoming data.

So the View which is being rendered should bind the path of the Icon in use to a tag binding against the tagPath being supplied as an incoming value.