Dynamic queries in a list view

In this screenshot, you'll notice that I have a list view which contains a select box called 'Previous BFPP'. The options for each instance of this dropdown need to be dynamically populated from the results of an API call that uses the UUID of the current row's data as part of the path.

The closest equivalent I can think of is if I was building this in React, I might have a BfppCard component which would run the query when the component gets mounted and then populate a state value.

Is it even possible to create such a dynamic, context-aware dropdown in Retool? If so, how would I go about implementing this?

Hello and welcome back to the forums!

I think this is accomplished by chaining the API call to the event handler of the Select Box's Focus event. Just like when you click a button in the List View component, you should be able to access the item:

This should allow you to trigger the API query for that row's UUID value (item.uuid or however it is stored in your List View data) and populate the dropdown with the results of the resource query.

The end result should be that any time you grab the select component from that List View entry, the API query runs and repopulates the selectable data.

CAVEAT: I haven't set this up to determine if it would affect other row entries how the overall list view will behave if the data sources for the components keep changing.

1 Like