First off, our team is so excited about all the big improvements that have been made lately... Retool is getting so much better!
As we move to a more module based setup, we want to be able to trigger a query inside a module from the parent app. For example: we want to be able to clear all the fields inside the module at once.
It seems like I may be able to do something using these autocomplete functions but they all throw errors and don't behave as expected.
The other option would be to do something by passing in an input value, but I'm not sure how to handle state there (once it's been clicked once, how to reset and let it get clicked again).
Hi! This is super helpful to me right now as I'm working on trying to trigger a module query from the parent app. I think I'll be able to work through it with the text alone, but the screen shots would be super helpful. Unfortunately, they aren't showing up in the response. Would someone from the Retool Team be able to re-add them?
I want to do a similar thing as alex-godin. And the solution seems a bit hacky for what I am trying to do.
I created an 'init' script for my module, setting all the default values whenever the module is opened in the main app. I simply want to trigger this script manually, without relying on input changes.
A big appeal of the of the business plan is the ability to make a lot of small modules, similar to how I would make class in regular coding. The reason I simply want to run init is also because of my coding mindset. In my opinion, a module should work independently of the parent app. Having to create an input field with a query from the parent app to simply run my init script ruins this independence and thus the appeal to make a lot of modules.
It seems my way of working/thinking is wrong though, it there a better way to do this (clear/ init module in parent app without having to create an input in the module for each parent app in which it is used)
EDIT:
Based on this thread, I found a good setup to run module scripts from the parent app which works well for me. Looking forward to share it soon.
I've been dealing with this limitation for quite a long time, but I've not found a solution so far. From what I can tell based on the responses, there must be some way to trigger queries inside of modules - I just can't seem to figure out how.
Ideally, I would expect the Output parameters of a module to be set as Queries, similar to how Input parameters behave. That way, you could simply refer to the module and trigger the exposed queries.
Would love to hear your opinion on this matter.
Thanks!
P.s. If you're wondering why I am looking for something like this, here's why: if you were to add a form to a module, and then load that module into a modal/popup, and you would like that modal/popup's submit button (which, of course, is located outside of the module), to trigger the save query of the module, then there's no way for this button to interact with the module and trigger that query - at least as far I can tell based on my experience.
Hey @emozio - I haven't specifically heard if this feature will make it into our upcoming revamp of modules, but it's a pain point that comes up relatively often. Victoria's above guide is the pattern that I recommend most often. If you have questions about that implementation, I'd be happy to elaborate. Alternatively, you're always welcome to join us for scheduled Office Hours.