[BUG-13817] style defined for columns not applied in perspective table

The designer shows a style property for perspective table columns. Styles defined there are not applied to the cell.
I know that a cell object with styles can be passed to the column and this works good, but for simple formattings it would be more straight forward to have the styles property applied to the column.
Ignition Version 8.0.3

Edit:
I’m talking about the style property in defined columns:

1 Like

I don’t see a style property for columns. There is a style property for rows and for cells. The latter does what I think you are describing.

Hi,

Sorry for the delay. I don’t think it works the way you would expect. That style is actually applied to a column underlay that sits beneath the table body, so in order to see it take effect, you’d have to remove any styling or rows, if that makes sense. Despite all of that, you’re right, it doesn’t work because it’s getting overshadowed by an internal background color being set on the tables body. This is all set to change very soon, as we plan to provide you with the ability to style every piece of the table. I think adding a cells style object in the column config may be a good idea so that it can override the global cells style object that sits at the root of the table. I’ll include this in our existing ticket. In the meantime, if you want to apply styles to the cells of a column, you can try transforming your data so that each cell of that column is a custom object containing a style property. It’s a bit of a workaround, but should get you what you need for now.
Assuming you are using a dataset, something like this might work.

	output_json = []
	    
	style_zeit_meld = {"backgroundColor": "#F7901D"}
	
	for row in range(value.getRowCount()):
		row_object = {}
		for col in range(value.getColumnCount()):
			if value.getColumnName(col) == 'zeit_meld':
				cell_object = {}
				cell_object['value'] = value.getValueAt(row, col)
				cell_object['style'] = zeit_meld_style
				row_object['city'] = cell_object
			else:
				row_object[value.getColumnName(col)] = value.getValueAt(row, col)
			
			output_json.append(row_object)
	        
	return output_json

-Y

What is the current status of this ticket?

Nothing has change, but I’ll do my best to move it forward. Hopefully soon.

I’m still experiencing this bug in Ignition 8.1.9, is this ticket still active?

Same thing here - is there a targeted release for this anytime soon? It is quite annoying.

The table got a variety of new style props in 8.1.11:
https://docs.inductiveautomation.com/display/DOC81/New+in+this+Version#NewinthisVersion-Perspective.1

1 Like

Thank you. Your solution works well for me.