"getDisplayTextAt" function use for table component

I want to know how to use “getDisplayTextAt” function in scripting of table component to read data at selected cell and display it in the text filed which is present in parent container.

getDisplayTextAt() is called for every cell in your table, not just the selected cell, and returns a string to be displayed in that cell. It’s used to alter what’s displayed in cells of the table.

Thanks for the reply.

Hi roshanbhosale,

As Kathy said, the getDisplayTextAt() function is called for every cell and is used to return the text that is displayed in each cell of a table.

For what you want to do I recommend a propertyChange script on the table like this:

if event.propertyName in ["selectedColumn","selectedRow"]: value = str(event.source.data.getValueAt(event.source.selectedRow,event.source.selectedColumn)) event.source.parent.getComponent('Text Field').text = valueEach time a different cell is selected the text box is updated with the text.

Best,

1 Like

thanks for reply…

I have a similar question concerning getDisplayTextAt extension function of a table component.
I tried entering the following -

if colName == 'Action':
			if value > 0:
				return {'text': 'Hold','foreground': system.gui.color(255,0,0)}
			else: 
				return {'text': 'Crash','foreground': system.gui.color (0,128,0)}

I get no change at all to my table. I’m trying to have text displayed based on the value of the column ‘Action’