Select row always refresh table to default row

I'm new to ReTool and perhaps this is a simple thing to adjust.
I'm noticing that selecting a row in my table always refreshes the table to the default row.
If I set the Default row to None, the selectedRow is null.

In this example, Alexa is the default selected row. If I click on Hannah, the table highlights Alexa again.


Thanks in advance!

Hi Luke!

If your selected row is resetting with every click, this could mean that your select row handler is refreshing the data that is fed into your table. Is get_accounts also the query used for your table's data?

To help fix this, it looks like you don't have a Primary Key column set for your table. Does your data have a column you could use as primary key? Having a Primary Key helps the Table keep track of which row is which, so even if your data changes or refreshes, the table knows which row to keep selected.

To add a primary key column, you can "Regenerate columns" or "Add a new column" with a source key, and then select a column as your Primary Key in the dropdown:

1 Like

Thanks for the reply Annawang!

I discovered the problem was indeed the handler as it was populating the list again. However I'm wondering, reading your comment, if adding the Primary Key would have solved this behaviour even with the handler configured?

Hi Luke,

Yes, a primary key would help the Table maintain your selected row even if the data is refreshed! This is because primary keys allow the Table can keep track of each unique row, so it can keep your row selection even if rows are added or deleted from your table.

Primary key columns are helpful for row selection logic, as well as changeset logic. If you don't want your primary key column visible, you can also set the column to be hidden so the Table can still keep track of rows. Hope this helps!