Let me decide which query runs when a table's refresh button is clicked

I often have tables that have a JSON with SQL query to make filtering more performant.

But sometimes I want to let the user re-query the underlying data source. The refresh button just re-queries the JSON, not the JSON's source query.

If I could hook into the button through either a "refresh' event or maybe a new property to let me specify which query runs when the refresh button is clicked.

Hey Bradly! The table's refresh button tries automatically to identify all direct inputs, so that an input like {{ query1.data.concat(query2.data)}} would rerun both queries and might get tricky in scenarios with multiple queries or if we start thinking about how many dependent queries back from those direct inputs should be re-run. A new feature for flat override + event handler could work here, but I do have one workaround option:

How about using the table's Custom button option, hiding the refresh button, and having that point at the source query instead of the Query JSON with SQL one? If you need some more complexity, that target query of the custom button could be a Run JS code query!

You can also drop unicode emoji's in here like :arrows_counterclockwise:, though I wish this input supported our new icon library! I'll mention it internally and see how difficult it would be to add to the scope on this input.

I agree and I see the potential issue with climbing the call stack on queries. I would recommend keeping the limits on this and only firing queries when parameters change (as it stands now) and not say, firing queries based on other queries changing. As you point out, this would make tracing the execution path of queries even harder than it can sometime be.

Your workaround is a good idea. and I have implemented it in two apps in question.

1 Like

Just a note for others, this has been enabled in the new table.

You can select any standard event handler when you click the refresh button.

In fact the refresh button is just a normal Toolbar Button that is automatically created when you add a Toolbar add-on.