I'm having issues automatically selecting the first row of a table when I'm searching (via an attached searchbox that updates the query) and when it's first loaded. The problem happens only when I have the Primary key set. I looks at some solutions but couldn't find anything that worked except for removing the primary key (which I prefer not to do).
Hi @nagar ,
I understand the issue you're facing. I have encountered and resolved a similar scenario in one of my Retool applications, and the following approach worked well for me.
Solution
1. Clear the table selection when the query succeeds
In your query's Success Event Handler , add a Clear Selection action for the table first, as shown below:
With these two actions in place, whenever the query is triggered (whether by search, filter changes, or a manual refresh), the table selection will be reset first and then automatically select the first row in the refreshed dataset.
This should ensure that the first row remains selected consistently after every query execution.
Hope this helps! Let me know if you need any additional assistance or if your setup behaves differently.