Custom formatting of SQL query result into HMTL/Text widget

Is there any way to render custom HTML (for a Text widget, which seems to be the only theoretical way ?) from an SQL query result?

My thinking was that I could possibly set the Text from a JS function which in turn calls the SQL query, formats the result to HTML and then returns the HTML for the Text widget…

But first, I don’t understand how the SQL query actually async returns the data when called from JS and then I don’t see how the resulting HTML could be then set for the Text widget …?

@arminus Hey, instead of a text widget, have you tried rendering the HTML into the Iframe widget, using the srcDoc property?

Hey @dancia IFrame requires a URL which I don’t have for this usecase…?

The question is really, what can I do if the provided widgets aren’t sufficient. Of course I can build my own API/endpoint completely outside Appsmith, return some custom HTML and then put it into the IFrame.

I was just wondering if that’d be possible with just some JS inside Appsmith and only relying on an Appsmith query.

@arminus Sorry if I’m not understanding your question correctly, but the srcDoc property takes HTML. You don’t have to use the URL property.

Ok, I saw this and stopped. Will try again later

2022-01-27_142605

Cool, this works, thanks!

1 Like