Integrate the RichTextEditor component into a Grid dialog template in editing mode

In the actionComplete method, I create a RichTextEditor object:

...

 new ej.richtexteditor.RichTextEditor(
 {
 height: 300,
 placeholder: 'Description',
 floatLabelType: 'Always',
 toolbarSettings: {
 items: ['Bold', 'Italic', 'Underline', '|',
 'Formats', 'Alignments', 'OrderedList', 'UnorderedList', '|',
 'CreateLink', 'Image', '|', 'SourceCode']
 },
 value: args.rowData.description
 },
 args.form.elements.namedItem('description')
 );

....


And in the template script (of the dialog), I link it like this:


<div class="col-12">
 <div class="e-float-input e-control-wrapper">
 <textarea id="description" name="description" type="text" value=\${if(isAdd)} '' \${else} \${description} \${/if}></textarea>
 </div>
 </div>

The problem is that the result, the value of "description" is duplicated:

Image_6288_1722957839843


Can you provide an example of how to integrate RichTextEditor into the template correctly?


Thank you


9 Replies

DM Dineshnarasimman Muthu Syncfusion Team August 7, 2024 03:00 PM UTC

Hi Manuel,


Greetings from Syncfusion Support.


We have reviewed your query about textarea displaying when RichTextEditor is bound in the dialog template of the grid. We noticed that you have wrapped the textarea tag using a div element with which contains e-float-input class. When binding the RichTextEditor to the textArea element, the RTE component will set display none to the textarea element. In this case, when wrapping textArea element with e-float-input element, the display none style is overridden. 


We suggest you to remove the e-float-input class from the div element, the code snippet have been attached for your reference.



 <div class="form-row">

                <div class="form-group col-md-6">

                    <input type="text" name="ShipCountry" id="ShipCountry" value=${if(ShipCountry === null || ShipCountry === undefined)} '' ${else} ${ShipCountry} ${/if} />

                </div>

                <div class="col-md-12">

                    <div class="e-control-wrapper">

                    <textarea type="text" name="ShipCity" id="ShipCity" value=${if(ShipCity === null || ShipCity === undefined)} '' ${else} ${ShipCity} ${/if}></textarea>

                </div>

            </div>

            </div>

 

 


Also, you can set override the styles property of the richtexteditor element in the html page



    <style>

      .e-richtexteditor .e-rte-hidden {

        displaynone !important;

      }

    </style>

 


Image:





Sample: https://stackblitz.com/edit/q1rdpr-x9gjtj?file=index.js,index.html


Please let us know if you need any further assistance.


Regards,

Dineshnarasimman M




MA Manuel August 9, 2024 05:23 AM UTC

thanks for your help  Dineshnarasimman Muthu.


The support is fantastic!!!



SA Surah Al Waqiah August 9, 2024 11:39 AM UTC

It looks like you're duplicating the initialization of the RichTextEditor by creating it in the actionComplete method and then linking it again in the template. Instead, try initializing the RichTextEditor only in the actionComplete method, and ensure that your template only contains the textarea without re-assigning the value.

Here's how you can streamline it:

  1. Template:

    html
    <div class="col-12"> <div class="e-float-input e-control-wrapper"> <textarea id="description" name="description"></textarea> </div> </div>
  2. actionComplete Method:

    javascript
    if (args.requestType === 'beginEdit' || args.requestType === 'add') { new ej.richtexteditor.RichTextEditor({ height: 300, placeholder: 'Description', floatLabelType: 'Always', toolbarSettings: { items: ['Bold', 'Italic', 'Underline', '|', 'Formats', 'Alignments', 'OrderedList', 'UnorderedList', '|', 'CreateLink', 'Image', '|', 'SourceCode'] }, value: args.rowData ? args.rowData.description : '' }, args.form.elements.namedItem('description')); }

This approach ensures that the RichTextEditor is only initialized once, and it correctly binds the value without duplication.



DM Dineshnarasimman Muthu Syncfusion Team August 12, 2024 01:50 PM UTC

Hi Surah,


We have reviewed your suggestion regarding the not assigning the value to the textArea component to overcome this textarea element duplicate. We would like to tell you that value in the textarea element won't be necessary as we have already the provided the value in the actionComplete event of the grid.


However, even when removing the value element from the text area, the textarea element and RTE both will be displayed. Like we said in the previous update the display property is overridden due to the e-float-input class which is wrapped to the textarea element. You can either remove e-float-input class name or you can set display none property to the e-richtexteditor .e-rte-hidden class.


Sample: https://stackblitz.com/edit/q1rdpr-decnko?file=index.js,index.html


We have attached the sample for your reference.


Regards,

Dineshnarasimman M



JS jack smith May 21, 2025 12:32 PM UTC


"Integrated the RichTextEditor into the Grid's dialog template for enhanced text editing during edit mode."

.



SR Sivaranjani Rajasekaran Syncfusion Team May 23, 2025 04:52 AM UTC


Thank you for the update. We're glad to hear that you were able to successfully integrate the RichTextEditor into the Grid's dialog template for enhanced text editing during edit mode.
If you have any other requirements or need further assistance, please feel free to share them with us. We're happy to help!


JS jack smith May 23, 2025 09:56 AM UTC

Integrating the RichTextEditor component into a Grid dialog template in editing mode enhances the user experience by allowing formatted text input directly within data grids. This is particularly useful for content-heavy fields like descriptions or notes. However, it requires careful configuration to ensure compatibility with the grid's data binding and validation systems. Done right, it creates a seamless and powerful editing interface within a structured UI.



KM Kishore Muthukrishnan Syncfusion Team May 27, 2025 07:46 AM UTC

Hi jack smith,

 

Thank you for the update. We appreciate your insights on integrating the RichTextEditor into the Grid’s dialog template ensuring compatibility with data binding and validation is indeed key to a seamless integration. We are glad to hear the integration went well. If you need further assistance, feel free to let us know!

 

Regards,

Kishore Muthukrishnan



DT David Trent November 22, 2025 08:35 AM UTC

Integrating the RichTextEditor into a Grid dialog makes it super easy to create and edit personalized content—perfect for crafting thoughtful Birthday Wishes for Friends right within your app! 


Loader.
Up arrow icon