0

I have LWC component that creates new record using lighting record edit form and then on search displays the record in Lightning-datatable. # However the new record created are showing the html tags for the Rich text area fields whereas this doesn't happen for the records already created. Is there any way to remove them? TIA

enter image description here

HTML:

    <div class="slds-col slds-order_2">
                <lightning-button label="Add New" variant="brand"  onclick={navigateToNew}> 
   </lightning-button>
   </div>

   <template if:true={isDataLoaded}>
           <div style="height: 300px;">
           <lightning-datatable key-field="id"
                         columns={columns}
                         data={searchData}
                         hide-checkbox-column
                         sorted-by={sortedBy}>
          </lightning-datatable>
        </div>
      </template>

JS:

   navigateToNew() {
    this[NavigationMixin.Navigate]({
        type: 'standard__objectPage',
        attributes: {
           objectApiName: 'Custom Object',
           actionName: 'new'
        }        
    });
}
5
  • 1
    Can you avoid using a rich text area? If you can't you will probably need to extend the datatable with a new display component - datatable doesn't have a richtext cell element out of the box, but it's not too hard to add one Commented Mar 24, 2021 at 13:29
  • Can't change the rich text area field. Will have to add the component then. But why is it happening only for the new records created. Commented Mar 24, 2021 at 14:02
  • So if you then reload the list from the database, does the <p> markup go away? Will prob need to see more of your code... Commented Mar 24, 2021 at 18:09
  • Do you have a link for the solution of similar scenario. Would highly appreciate it. !! Commented Mar 24, 2021 at 19:51
  • So I did the changes in Apex rather than doing it in js.html and it worked. Commented Mar 24, 2021 at 20:37

0

You must log in to answer this question.

Browse other questions tagged .