I have a table that uses HTML columns extensively. I have buttons to open modals to edit the underlying data. They do take up quite a bit of real estate however. What I would be really slick is to do is have <a> links that open the modals. This would also duplicate the functionality the users are used to with the old web site Retool is replacing.
Link 1 in red opens a a different app in into a new tab which replaces the View Project button. That works just fine now.
Link 2 would hopefully open a modal which edits the Job. Right now I have the Edit Job button.
Link 3 would open the individual task in a modal, but I have to use the Edit/Add tasks button right now. That column is showing multiple sub records.
So what I am asking for is a way to call a query from an <a> tag. Would also be useful for inline links in HTML components.
I realize that I could get the effect I am looking for if I re-did this table to use a ListView component and used the Link component. But I would need to nest the ListViews to get the sub records (which actually works) but there are significant performance issues with that method right now.
At the moment, the team is still working on adding more robust handlers to link and button columns and it may be a bit until this level of granularity is reached but we can report back here when there's an update or if there are other changes that make this more feasible.
In the meantime, have you tried setting the hash parameters of your app using your links and then listening for changes in those parameters with, for instance, a Query JSON with SQL query? You can then use the event handlers on that query to trigger various actions:
Hi there. Can you please show an example of how to create a HTML link which sets the hash parameters?
I just want to trigger a SQL query to run on click a HTML link in the HTML column.
Also looking to save space by not having another column just for a button.
Another 2 problems I ran across with this technique and one solution:
When you use this as your URL - {{urlparams.href}}#editjob={{currentRow.job_id}} - you run into a situation where you keep appending hash params every time you click a link:
This clears everything after the hash so yo have a nice clean URL to go to.
The problem I don't have an answer for yet: If the user refreshes the page, the url hash will still be there and whatever action you had defined for that condition will happen again. In my case a modal pops up ready to edit the selected record. So this isn't a completely solved problem yet.
Hard disagree, this is a very weird and roundabout workaround. I would like to be able to have a button in a table execute a Javascript query, or execute some JS code - similarly to how we can execute arbitrary code for certain events within a table
My original post was about running a query or JS from links within an HTML column, which is a pretty advanced and specialized use case I do not expect Retool to prioritize any time soon.