Reputation: 17701
I have an antd table where i am trying to convert the result field value that will include html attributes string into the respective styles for one of the column and i have failed with that conversion
below is my string where i am looking into convert
The exhaust air requirements for fume hoods will be based on maintaining a face velocity of <b>[100] [80] [60]</b> fpm through the open sash with the sash <b>[100% open] [50% open] [positioned at 18" above work surface]</b>
i am looking for the below kind of string
The exhaust air requirements for fume hoods will be based on maintaining a face velocity of [100] [80] [60] fpm through the open sash with the sash [100% open] [50% open] [positioned at 18" above work surface]
but in the table it is looking like in below image
I am looking for render function that will take those html tags and render the string like as above but could not be able to get that.
Could any one please suggest or any help on this issue that would be very grateful to me, many thanks in advance
I am using react JS
with ANTD library and below is the column configuration for table
{
title: 'Narrative Description',
name: 'exhaustEquipmentNarrativeHTML',
table: {
sortable: SORTABLE.ALPHA,
searchable: true,
width: '20%'
render: text => {
return ''; // this is where i am stuck in
}
},
drawer: {
component: JoditAdapter,
isReadOnly: false
}
},
Upvotes: 1
Views: 118
Reputation: 11305
According to docs render
can return ReactNode
And it looks like you want to use dangerouslySetInnerHTML
render: text => {
return <span dangerouslySetInnerHTML={{__html: text}}></span>
}
Upvotes: 2