We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Add other component on popup dialog

Hi,
I have a grid of items, each of item contains a button when it is clicked popping a dialog. In the dialog I want to have a file uploader component from syncfusion. I tried this way, but didn't work well.


Browser Error:

I do have attached dialog to html element.

1 Reply

NP Narayanasamy Panneer Selvam Syncfusion Team July 26, 2019 02:52 AM UTC

Hi Peng, 
We have analyzed shared code blocks and suspect that target element and appendTo method not at all used to render a EJ2 components in your sample, so that you may got the reported console error. 
  
For your convenience we have prepared stackblitz sample with your shared code block. Please find it in the following link: https://stackblitz.com/edit/ixcixu-52reuf?file=index.js 
 
Also find detailed information of some important code block used in the sample, 
  
1. Define target elements in html page 
   
<div id="dialog"> 
    <input type="file" id="upload" name="UploadFiles"/> 
</div> 
 
2. Render uploader and dialog in given order

 
var dialog = new ej.popups.Dialog({ 
  header: 'Uploader', 
  showCloseIcon: true, 
  visible: false, 
  target: "#target" 
}); 
dialog.appendTo('#dialog'); // Initialize Dialog component 
 
var uploader = new ej.inputs.Uploader({ autoUpload: false }); 
uploader.appendTo('#upload'); // Initialize Uploader component 
 
 
3. Call dialog show method in grid button click event. 
 
function onClick() { 
  dialog.show(); 
} 
 
Note: Do not place component creation in button click handler, because each button click component reinitialized and duplicate element append in DOM. 
 
Regards,  
Narayanasamy P.  


Loader.
Live Chat Icon For mobile
Up arrow icon