Listen for panel open

219
2
Jump to solution
05-07-2019 05:57 AM
KevinHibma-EsriCA
Esri Contributor

Hi,

Would it be possible to setup an event to "listen" for a panel open? If so, could you provide a sample?

Specifically I want to listen for when the Edit widget > attribute editor popup opens and automatically update a value. There aren't really any hooks on the popup, I'd probably need to find it via the class name and then cycle through to the appropriate input attribute I want to populate. 

I have briefly looked at the Smart Editor and it appears to have more hooks, but I'd still need to solve the first problem of listening for it's open and then identifying the attribute panel. 

Workflow details....

The value being populated is coming from an input box on the theme/foldabletheme/widgets/headercontroller/widget.js /widget.html (essentially a session ID for the edit)

I realize there might be other ways to implement this workflow, and would consider them. At this point though we want to go with the idea of having a "global textbox" at the top of the app, you fill in this value and then as you create features via edit an attribute is populated with that value.

thanks

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Kevin,

   In the Editor Widget.js you will find that there is _onEditorPopupShow function that fires when the AttributeInspector is opened.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Kevin,

   In the Editor Widget.js you will find that there is _onEditorPopupShow function that fires when the AttributeInspector is opened.

KevinHibma-EsriCA
Esri Contributor

Thank you, Robert. As always, you're an encyclopedia of WAB knowledge.

Once you know where to look, it's pretty straight forward.

      _onEditorPopupShow: function() {
        // disable event for editorATI
        var currentFeature = this.editor.attributeInspector._currentFeature;

        if (!currentFeature.attributes.incidentid){
          var controller = WidgetManager.getInstance().getWidgetsByName('HeaderController');  
          var idval = controller[0].selectedValue;
          currentFeature.attributes.incidentid = idval;
        }

        //var currentLayer = currentFeature.getLayer();
        this._disableToAnswerEventForEditorATI();
        this._createRelatedRecordsEditor(currentFeature);

        this._pushToNeedRequeryFeatureArray(currentFeature);
        this._requeryFeature(currentFeature, true);

        this._updateOperationalButtons(currentFeature);
      },

And a small hack in _requeryFeature as it checks attributes on new feature create and resets back to null.

0 Kudos