0

I have a WAB (for developers, version 1.4, JS API 3.16) widget with an AttachmentEditor. Depending on the user's privileges (managed through MVC), I want to prevent some of the users from modifying the attachments (this I can do by hiding the editor) and still showing them the attachments, but I found no way to let the editor show the attachments without permitting the user to add/delete them. Do I need to hack the editor code and use the tweaked version, or is there any clean option to do this? Bypassing AttachmentEditor completely seems to be the hardest way, so I hope it is not necessary.

I reposted this on Geonet.

1 Answer 1

0

I got an answer on Geonet, thanks to Yusuf Ali!

Step 1, hide deleting:

.deleteAttachment{display:none;} 

Step 2, prevent adding new attachments:

dojo.query('> div > form', dojo.byId("attachment-editor-container")).style('display', 'none');

Step 3, hide parentheses left after hiding the delete icons:

var spans = dojo.query('> div > span > span', dojo.byId("attachment-editor-container"));  
for(var i = 0, sl = spans.length; i < sl; i++) {  
    spans[i].innerHTML = spans[i].innerHTML.replace(/[()]/g, '');  
} 
1
  • Please mark this answer as accepted. It's OK to accept your own answer. Commented Jun 25, 2018 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.