Hello, I have a table with 3 rows and 9 columns. On the 9th column I set the render to view, but instead of showing the corresponding view to its row, it repeats the same one if I choose the view path.
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/0/c/0ce8848d5f9e80d5414f43451a1ab6482c282e25.png)
I would like to display different views in that column, depending on the row.
Does anyone know what exactly should I do? I tried playing with the viewParams but got nowhere.
You want the value of data[0].chart to be used to get the viewpath?
Than your columns[9].viewpath should be to a view which has an embedded view component in it.
You will need to put a view param named ‘value’ there. This ‘params.value’ will automatically get the value of the corresponding data row.
You can than bind this param.value (which has the path to your view) to your embedded views path property.
you can also use rowData to get the whole data row instead of just the column if you need other data from the row to render your view
https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Table
1 Like
Each row had its own view, I wanted to set up the view path in each respective row (as it is in row 1 col 9). Using an embedded view with the view params set to value seem to have done the trick! Thanks for the reference and help
final result:
2 Likes
I'm doing something similar but with a slightly different data structure.
Instead of having the embedded view path in my table as a column to reference - I just have a text column that identifies if it's a dropdown selection, free-form text, numeric entry, datetime picker, etc.
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/6/3/631840c192199d8c71c3b6838c40f7ce8fde0ded.png)
So instead of having the datetime picker in every row I want it to use the 2nd column and change the type of embedded view.
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/8/5/859ab8b4608c3fed0f9f086982e979d4075aed09.png)
The tableCellView has a view param for viewPath which is retrieved via the rowData that is passed to the view. It is pulling out the correct view:
try:
entryType = value['param_egu']
except:
entryType = 'text'
# system.perspective.print(value)
# system.perspective.print(entryType)
if entryType == 'list':
viewPath = 'Page/Embedded/entryListDropDownMenu'
elif entryType == 'datetime':
viewPath = 'Page/Embedded/datetimePicker'
elif entryType == 'text':
viewPath = 'Page/Embedded/freeFormTextEntry'
else:
viewPath = 'Page/Embedded/numericEntry'
# system.perspective.print(viewPath)
return viewPath
What is happening is whenever I scroll the table it displays the correct embedded view - when I move my mouse a little then it disappears.
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/8/2/82f06fe105183a84d681abc2748a40487824130a.png)
From the above to the below (ignore the list ones, I have a bug in those dropdown views)
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/b/e/be3bf2fbd104087d48ef9f1665a8f25a0db28032.png)
I did check to make sure it wasn't the broken dropdown view and no difference.
Any ideas why the views show up correctly for a moment but then go away when it "repaints"? I also unbound the query for the table so it is using static values.
I'd prefer to use the table; my other options are to just build out the rows into individual views and/or do a flex repeater.
Thanks for any help!
Figured it out.
Need to take special care of params.
I originally had the rowData param and a viewPath param on the tableCellView - I removed the viewPath param and moved the parsing script to the path property on the embedded component.
Also I was trying to use a value param to capture what was selected/typed but I think that was interferring with the value param that gets passed automatically. So I updated it to valueEntered.
Sometimes typing things out helps troubleshooting ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12)