Select to view content in your preferred language

Editor widget not responding properly on event call.

404
1
07-20-2022 04:32 AM
PrabalGupta
New Contributor

Hello community members, I am GIS developer working on a certain project where I need to call the editor widget in a division on a click event. 

"require([
       
    "esri/widgets/Editor"
   
      ], (
       
    Editor
      ) => {
     
         // view.popup.autoOpenEnabled = false; //disable popups
          // Create the Editor
        const editor = new Editor({
          view: view,
          container:collapseEight
        });
        // Add widget to top-right of the view
        collapseEight.addEventListener("click", function(){
          view.ui.add(editor, "edit")
          })
        view.ui.add("edit", "collapseEight");

    })"
 
I am using the above piece of code for doing the same, but the issue is that the widget is misbehaving on the event call. Sometimes it appears on the event call, but most of the time it doesn't. 
 
It would be of a great help if anybody from the community could share their knowledge on this issue.
0 Kudos
1 Reply
AnneFitz
Esri Regular Contributor

Hi, 

view.ui.add should be used to add something (i.e. a widget/HTML element) to a certain position in the view (i.e. "top-right" or "bottom-left"). It is not used to add elements into other HTML elements. This might be what is causing your issue. 

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-ui-DefaultUI.html#add

 

0 Kudos