Table component :: How to select and hilight a row

Hi there,

I am using several table component in our project to list and select different items.
I would like to select a row (by script) on the table … I tried to set the var: Selection.selectedRow = xyz but the item is not highlighting nor fire ‘onSelection’ change event.

is there a way to do that?

1 Like
		event.source.getComponent('Table').selectedRow = 5

This would be an example script running from the root container which would do this.

Hi Tim. I think your answer is not working.
first of all, thanks for your quick reply.

I’ve put your script ‘onStartup’ action on the view which has the table in it because I cannot figure out where to put your script a root within this view.

then, what is the prop ‘event’ and from where it comes from (context) ?.

lastly, I tried this (onStartup of the view): self.getRootContainer().getChild(‘Table’).selectedRow = 1
got an error because selectedRow prop. doesn’t exists at all…

Sorry if I misunderstood something… I am a bit stuck

Hi @beaudoin.stephane, @Tim has provided a Vision example while you’re looking for a perspective example. Is that correct?

Sorry, this example was for Vision. In Perspetive it would look like this. This example script was on a button onActionPerformed event.

self.getSibling("Table").props.selection.selectedRow = 5

Hi, to have something selected in a table, you have to set the props “selectedRow” AND “selectedColumn” of the table to something or else both will be set to NULL.

1 Like

Hi Tim, Yes the solution was for perspective.
The Alexis’s answer is working well. Indeed we have to set also a column to make the selection working.
Thanks for your reply.