ejDialog ContentTemplate

Hello,

Can anyone help me set egDialog contentTemplate in JS? What I want to do is as follow:

  •      I have a script type="text/template" in my view
  •      Onclick  of button, I want to open a dialog (egDialog) with the rendered script as content 

So is this possible? If so, how can I do it?

Thank you very much.


1 Reply

SS Selvamani Sankarappan Syncfusion Team November 17, 2017 06:49 AM UTC

Hi Aymen, 
 
Thanks for contacting Syncfusion support. 
 
You can pass the template content using setContent method of Dialog component. Please refer to the following code example: 
 
<script id="templatecontent" type="text/template"> 
        <p> 
            Simple Dialog 
        </p> 
    </script> 
    <script> 
         
        var templateEdit = $.templates("#templatecontent"); 
        var htmlOutputEdit = templateEdit.render({}); 
        function onOpen() { 
            $("#basicDialog").ejDialog("open"); 
            $("#basicDialog").ejDialog("setContent", htmlOutputEdit); 
        } 
    </script> 
Please refer to the following sample: 
 
If the above solution does not meet your requirement, kindly let us know with more details or code example based on your application to provide an appropriate solution at the earliest. 
 
Regards, 
 
Selvamani S. 


Loader.
Up arrow icon