How can I programmatically unselect a single row?

I'm trying to programmatically unselect a single row. I'm basically trying to keep two different views in sync and I have a javascript layer between them. Is there any way to accomplish this?

Welcome @Collin_Caram

Don't pass anything to selectRow. table.selectRow(). I find using a negative number also works. table.selectRow(-1). null seems to work as well table.selectRow(null). Brings up an interesting question about readability.

[EDIT] I think I misunderstood. You want to unselect a specific row. Like unselect row 2 :thinking:

Are you using multiselect table? Are the indices the same?

The indices are the same

Maybe a little hackish...

On row select change of table1 copy the selected indices to temp state var. Then use the temp state var to selectRow(temp state) of table2.

js query - table1 Row Select Change Event

const selected = table1.selectedRow.index;
selectedA.setValue(selected); // temp state

I have this in On Success js script of the above js query. I couldn't get this line to work when placed in the js query above. Maybe something requires a promise.


This example does it both directions

1 Like