Perspective table view column repeats same view

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

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

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

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
From the above to the below (ignore the list ones, I have a bug in those dropdown views)
image

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: