Perspective table column dynamic render type and viewPath

Is it possible to dynamically change the render type and viewPath for a row based on a value in the row?

I’m populating the table data with a simple dict list with a name and setting.
Then on a transform on the table data I’m doing the following to try and insert the render and viewPath as part of the data.

	tableRows = []
	for row in value:
		tableRow = {}
		tableRow['name'] = row.name
		settingValue = row.setting
		if self.view.custom.printer.driver == 'OS':
			if row.name == 'OSPrinterName':
				setting = {
					'value':row.setting,
					'render':'view',
					'viewPath':'Embedded/_Setup/_System/_Printers/Printer-List'
				}
		
		tableRow['setting'] = setting
		tableRows.append(tableRow)
	return tableRows

However it doesn’t seem to be changing the render type for that row and showing the view dictated in the viewPath.

Am I trying to do something that isn’t supported or am I missing something here?

Thanks for the help!

Hi @bschroeder, I don’t think this is supported, but I may be wrong.

The manual states (here):

Object data items must have a value property. Optionally they can also have properties to indicate the style for the object and whether it is editable.

I don’t think render and viewPath are valid properties. I believe this functionality is meant to be part of the props.rows.subview.

Using this you could create a generic view that takes the viewPath as a param and displays it. Then you just need to configure the subview.viewPath (which should be your generic view) and the viewParams (based on your row logic).

Some of the properties are randomly supported. Like enabled. So I was hoping that these were as well.

Your suggestion is my next step, I’m just trying to keep from having multiple layers if I don’t have to.

1 Like