Allow Javascript queries to automatically update when inputs change

I have a Javascript query that requests paginated data from a server, and displays it in a table. When I change the page of the table, the query does not update. The query uses the page information of the table to make its request, so there should be a way to make it automatically update when the selected page index changes.

2 Likes

First off, js queries do not automatically run, they have to be manually triggered. But you can get around this by creating a query that can automatically trigger, but do nothing, and then have your JS run onSuccess.

Putting {{mytable.selectedPageIndex}} into your do nothing query should work here.

This is a technique I have seen on the forums, but have not tried out yet.

1 Like

This is change is currently part of our roadmap and we are looking into supporting it in the near future 😁

2 Likes

Is this still on the roadmap? Or did it get implemented at some point? This would really be great to have, even if you can't autodetect inputs and we have to manually specify them.

1 Like

Hey @Yoni_Lerner!

There isn't a clear timeline for this at the moment but it is still getting some attention and we can let you know here when it is included. For now, the workaround @bradlymathews mentioned is likely your best bet.