[Data Grid Reactive] Is it possible to add text as HTML?
Forge component by OutSystems R&D
Application Type
Reactive

Hello


Is is possible to display rich text on a Text column? Like a text from CKEditor with italic and bold tags



Thanks!

Solution

Hello @Victor Salvalagio Pereira ,

It is possible to achieve something like this:

In this case, the Product Name column is allowing to receive html content and display it. First row is actually <u>Black and grey headphones</u>

For this, you can use this JS line in the screen or block that has the Data Grid On Ready event:

This will allow the content to be rendered as HTML.

Warning: we advise not to use this, if you don't control the source of the content, rendering HTML may be more susceptible to attacks like Cross Site Scripting. Also if the cell value is editable, you'll see the HTML markup.


In attachment, you can find a sample OML with this implementation.

Please keep in mind that this hasn't been tested for all possible use cases or that it cover all of your requirements, so we cannot assure that it will work for all use cases.

Please let us know if this helps.

Bruno Martinho

Html.oml

Hello @Victor Salvalagio Pereira ,

Currently Text Column only supports simple text, one of the reasons is security. If the component allows to render HTML, it may be more susceptible to attacks like Cross Site Scripting.

Can you please share a little bit more on your use case?

Thanks,

Bruno Martinho



Hi Bruno, thanks for your answer


I have an input using CKEditor to save a text with italic and bold, and I wanted to display this value formatted on the grid, without showing the HTML tags.

Solution

Hello @Victor Salvalagio Pereira ,

It is possible to achieve something like this:

In this case, the Product Name column is allowing to receive html content and display it. First row is actually <u>Black and grey headphones</u>

For this, you can use this JS line in the screen or block that has the Data Grid On Ready event:

This will allow the content to be rendered as HTML.

Warning: we advise not to use this, if you don't control the source of the content, rendering HTML may be more susceptible to attacks like Cross Site Scripting. Also if the cell value is editable, you'll see the HTML markup.


In attachment, you can find a sample OML with this implementation.

Please keep in mind that this hasn't been tested for all possible use cases or that it cover all of your requirements, so we cannot assure that it will work for all use cases.

Please let us know if this helps.

Bruno Martinho

Html.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.