My goal: Create a file uploader with grid preview of 20 slots that when the user clicks on any slot, they can select images from their PC and after selection, thumbnails would appear on the slots which the user can delete individual slots, delete all slots as well as reorder slots.
Issue: Retool does not render any JS upon calling. I used the HTML component as well as the Reorderable component. both fail at deleting images when calling JS queries. No reordering happens at all with the HTML component. I donβt know why scripting is not accepted in retool natively which is a basic feature. I spent an entire week on this without able to solve it not knowing what the real issue is. I tried all sorts of different things. Whereas using pure HTML+CSS+JS in one single file when testing on my browser worked flawlessly. I have provided the full code below.
Additional info: Cloud version used.
I have an example of how this should look in this pure HTML+CSS+JS file
Something we often do when we want to trigger a component is use the Query JSON with SQL resource and do something like
select * from {{ filepicker1.value }}
and have a success handler that has the JS. When you have your query JSON with SQL referencing the filepicker.value && on run automatically, it should trigger a run whenever it sees a change and then the JS will run on success. you could then have that JS update a variable that contains your gridview data and a image component that hides/unhides when data is added
Let me know if that works and if it all makes sense
No worries I will be creating a custom component for that in which I have full control over DOM events. I can customize every aspect of what I need. Thank you anyways.
I was going to recommend a custom component, as well! Building one out can be a little intimidating, but it enables a ton of things that Retool doesn't support natively. Plus it looks like you've done a lot of the work already!
One thing to note is that you'll probably want to convert the raw HTML/CSS/JS you've written into React. ChatGPT is honestly pretty good at stuff like that, but let me know if you have any questions!