Smart Editor widget bug?

633
5
Jump to solution
04-26-2022 07:53 PM
LefterisKoumis
Occasional Contributor III

This is for version 2.23 of WAB.

I noticed that if the template is closed and you open and close the Attribute Table, then you cannot click on any existing feature to edit its attributes.

The reason is because of the conditions shown in the mapclickhandler script.

In the widget.js under the _mapClickHandler function, if the template is not open it defaults to remove the mapClick.  So, I commented out the lines 18&19 to prevent that. Is any reason not to comment them out? As far I can see in my app it is working with no issues.

 

 

_mapClickHandler: function (create) {
        if (create === true && this._attrInspIsCurrentlyDisplayed === false) {
          this.map.setInfoWindowOnClick(false);
          if (this._mapClick === undefined || this._mapClick === null) {
            this._mapClick = on(this.map, "click", lang.hitch(this, this._onMapClick));
          }
          //this._activateTemplateToolbar();
        } else if (create === true && this._attrInspIsCurrentlyDisplayed === true) {
          if (this._mapClick) {
            this._mapClick.remove();
            this._mapClick = null;
          }
          this.map.setInfoWindowOnClick(true);
          //this._validateAttributes();
        } else {
          if (this._mapClick) {

          //  this._mapClick.remove();
         //   this._mapClick = null;
          }
          this.map.setInfoWindowOnClick(true);
          if (this.drawToolbar) {
            //this._lastDrawnShape = lang.clone(this.drawToolbar._points);
            this.drawToolbar.deactivate();
          }
        }
      },

 

 

 

0 Kudos
1 Solution

Accepted Solutions
AlixVezina
Esri Regular Contributor

@LefterisKoumis  Thank you for the recording, this helps.


When you click the Attribute Table (or any other widget in your app, actually), the Smart Editor becomes out of focus. You can see this by the red bar at the top of the widget panel. (I know, it's not very intuitive)

AlixVezina_0-1651086466077.png


If you click the Smart Editor widget panel again, the bar becomes green. If you click the feature to update again, it will be loaded in the attribute inspector.

AlixVezina_1-1651086689163.png

 

View solution in original post

0 Kudos
5 Replies
AlixVezina
Esri Regular Contributor

Hi @LefterisKoumis ,

If I understand this right, I believe this was added intentionally as we want to prevent editing features unless the Smart Editor widget is open and active. Otherwise, users may click a feature and it will be selected for editing even if Smart Editor is closed, and it will be difficult to view the feature's pop-up in the map.

I'm not sure where the Attribute Table fits into the workflow you are describing. Are you getting any console errors?

Please, are you able to share all the steps to reproduce the issue you are observing so we can try to reproduce it?

0 Kudos
LefterisKoumis
Occasional Contributor III

Hi. I think there is a misunderstanding. I was referring to edit existing features.  The reason of why I mentioned the Attribute Table is because when you open and close the AT, it triggers the _mapClickHandler function. Since the parameter "Create" is false then it fails the If and else if statements (lines 2 & 8 of the script I attached previously) and it passes to the else statement (line 15) and it removes the mapclick. From that point on, you cannot click on any existing feature to edit its attributes.

To illustrate of what the issue is I am attaching a video that shows the issue. 

At the beginning, I click some existing features as it is expected the form opens and allows me to edit the feature attributes if I wish. Then, I close the form. Next, I open and close the AT. Now, when I click on any feature I cannot edit any features. Then I access the code and I comment out the two lines in the _mapClickHandler function function. Save the file and reload the website. I open and close the AT and now I can click on any existing feature and edit its attributes.

0 Kudos
AlixVezina
Esri Regular Contributor

@LefterisKoumis  Thank you for the recording, this helps.


When you click the Attribute Table (or any other widget in your app, actually), the Smart Editor becomes out of focus. You can see this by the red bar at the top of the widget panel. (I know, it's not very intuitive)

AlixVezina_0-1651086466077.png


If you click the Smart Editor widget panel again, the bar becomes green. If you click the feature to update again, it will be loaded in the attribute inspector.

AlixVezina_1-1651086689163.png

 

0 Kudos
LefterisKoumis
Occasional Contributor III

ok understood.  Yes, not intuitive at all. It is becoming difficult to train users who are not very experienced with web apps to be aware of the red bar. By commenting out those two lines as I mentioned before, I still have not seen any issues. Users can process to edit features after using the AT. Do you see any specific scenario that commenting out those two lines would cause issues?

0 Kudos
AlixVezina
Esri Regular Contributor

Since you are using the Jewelry Box theme and the Smart Editor remains open in the panel at all times, I think your approach should be fine.

 

0 Kudos