popupOpen(args: BeforePopupOpenCloseEventArgs) {
if (args.popupName == 'Upload') {
var input = document.createElement('button');
input.innerText = 'Click';
args.popupModule.dlgContainer
.querySelector('.e-dlg-content')
.append(input);
}
}
uploadListCreate(args: UploadListCreateArgs) {
var ele = document.querySelector('.e-upload.e-control-wrapper');
var label = document.createElement('label');
label.textContent = 'Enter comments:';
var input = document.createElement('input');
input.setAttribute('type', 'text');
// You can update required controls here
ele.prepend(input);
ele.prepend(label);
}
|
|
//Status value changed in popup
args.element.querySelector('.e-file-status').innerText = 'Are you sure to upload?'; |
|
// Upload action will trigger for Click button
btn.onclick = function() {
(document.getElementsByClassName('e-file-upload-btn')[0]).click();
}; |
I tried to implement this and the solution is working perfectly fine. there is one slight problem that 'click' button, label and input field are being rendered every time we click on upload.
I have tried removing the elements by id every time the popup is closed but its causes an error with other popups. Is there any way we can prevent this?
Hi kanishka,
As per the shared details, we understand that you are facing an issue with the upload popup while trying to repeat the upload operation will create multiple “Click” buttons and input fields in the popup. We have checked the reported issue with a previously shared sample from our side and we are able to replicate the reported issue from our side. To overcome the issue, we suggest you add the below condition in popupopen and uploadListCreate event to avoid the mentioned element being rendered every time from your side. We have attached the modified sample for your reference.
Refer to the below code snippet.
[app.component.ts],
popupOpen(args: BeforePopupOpenCloseEventArgs) { if (args.popupName == 'Upload') { if (document.getElementById('btn') == null) { var btn = document.createElement('button'); btn.innerText = 'Click'; ... } } } uploadListCreate(args: UploadListCreateArgs) { if ( document.getElementById('lbl') == null && document.getElementById('txt') == null ) { ... args.element.querySelector('.e-file-status').innerText = 'Are you sure to upload?'; } else { document.getElementById('txt').value = ''; } }
|
Sample: https://stackblitz.com/edit/angular-dialog-customization-filemanager-quq16d?file=app.component.ts
Please check the shared sample and get back to us if you need any further assistance.
Regards,
Sivakumar S