"selected row" feature

hey everyone,
I have a table with rows that can be selected (and then data in a different table is filtered by this selection)
Whenever I adjust the dates, my selection changes... I want it to stay on the same row.
Is there a way to achieve that?

Thank you
Yael

Hi @Yael_Cohen,

Sorry, what do you mean by

Whenever I adjust the dates, my selection changes

Is it an adjustment within your table's row, or is it another component? Is a query running that refreshes your table's data set?

Use the persist row selection feature in the table you are selecting in....

Screenshot 2025-03-17 at 11.57.35 AM

1 Like

how do I reach this feature? this is what I'm seeing:
image

yes, it's a query that's refreshing the data (whenever the dates are changed)

Click on table component and do not select anything else.... in the inspector scroll down to the following:

i don't have it :frowning:
that's all there is:


Hi @Yael_Cohen,

You're using the legacy table, that's why you are not seeing it.

Are you on-prem?

What you could do is set up a variable that stores your latest selected row, and set up an event handler on your query to select the Row based on the primary key. It's been a while since I last used a legacy table, and I'm not able to find the documentation for it, so I'm not able to provide a more accurate description of what properties, methods you could use.

2 Likes

sorry, what does "on-prem" means?
can I change it to the new table component?

Hi @Yael_Cohen,

That you're hosting retool on your own premises, but I guess you aren't.

Yes, you can change it to a new table component, here's a quick guide that you can use.

However, switching to the new table ultimately requires deleting the legacy table and replacing it with the new table (as well as modifying any table queries/logic accordingly).

1 Like

all right, and how can I use the new table's selected row?
now I have a query that does that:

    campaign_name in UNNEST ({{ CampaignsTable.selectedRow.data.length > 0 ? CampaignsTable.selectedRow.data.map(campaign => campaign.campaign_name) : FilteredCampaigns.value.campaign_name}})

meaning if there are selected rows then show data only for them, and if there aren't any selected rows then show everything. can I use the same syntax?

Thank you so much for all the help

So, I think you can use:

    campaign_name in UNNEST ({{ CampaignsTable.selectedRow ? CampaignsTable.selectedRow.campaign_name : FilteredCampaigns.value.campaign_name}})

Bear in mind that selectedRow is only one Row, if you are using multiple select, then you will have to use selectedRows, and then reuse the map functoin you were doing

1 Like

not sure why it's not working... maybe I'll open a separate post for this