Select to view content in your preferred language

GP Link in Popup Panel Widget

1059
2
Jump to solution
04-11-2017 08:18 AM
LesiMai3
Deactivated User

Hi,

I'm trying to have a GP tool link (ArcGIS API for JavaScript Sandbox) appears in the Robert's Popup Panel Widget https://community.esri.com/docs/DOC-7355 . I'm using the 2.1.1 version of the widget. How can I overwrite the map popup used in the widget?

Thank you for your help!

Lesi

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Lesi,

  In the Widget.js make these changes (add lines 25-33 and 43-47):

      postCreate: function () {
        this.inherited(arguments);
        this.popupMenu = PopupMenu.getInstance();
        this.featureActionManager = FeatureActionManager.getInstance();
        domUtils.hide(this.actionsPaneDiv);
        this.own(on(this.domNode, 'mousedown', lang.hitch(this, function (event) {
          event.stopPropagation();
          if (event.altKey) {
            var msgStr = this.nls.widgetverstr + ': ' + this.manifest.version;
            msgStr += '\n' + this.nls.wabversionmsg + ': ' + this.manifest.wabVersion;
            msgStr += '\n' + this.manifest.description;
            new Message({
              titleLabel: this.nls.widgetversion,
              message: msgStr
            });
          }
        })));

        this.popup = this.map.infoWindow;

        this.zt = domConstruct.toDom('<a title="Zoom" to="" class="action zoomTo" href="javascript:void(0);"><span>' +
                                    esriBundle.widgets.popup.NLS_zoomTo + '</span></a>');
        domConstruct.place(this.zt, this.actionsListDiv);

        var link = domConstruct.create("a",{
          "class": "action",
          "id": "statsLink",
          "innerHTML": "Population", //text that appears in the popup for the link
          "href": "javascript: void(0);"
        }, this.actionsListDiv);

        //when the link is clicked register a function that will run
        on(link, "click", lang.hitch(this, this.calculatePopulation));

        this.clearSel = domConstruct.toDom('<a title="' + this.nls.clearseltip +'" to="" class="action clearSel" href="javascript:void(0);"><span>' + this.nls.clearsel + '</span></a>');
        domConstruct.place(this.clearSel, this.actionsListDiv);
        topic.subscribe("widgetsActionsRegistered", lang.hitch(this, this._onWidgetsActionsRegistered));
        this._createPopupMenuButton();
        this.setEvtHandlers();
        this.onWindowResize();
      },

      calculatePopulation: function(){
        var feature = this.popup.getSelectedFeature();
        console.info(feature);
        console.info("calc pop clicked")
      },

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Lesi,

  In the Widget.js make these changes (add lines 25-33 and 43-47):

      postCreate: function () {
        this.inherited(arguments);
        this.popupMenu = PopupMenu.getInstance();
        this.featureActionManager = FeatureActionManager.getInstance();
        domUtils.hide(this.actionsPaneDiv);
        this.own(on(this.domNode, 'mousedown', lang.hitch(this, function (event) {
          event.stopPropagation();
          if (event.altKey) {
            var msgStr = this.nls.widgetverstr + ': ' + this.manifest.version;
            msgStr += '\n' + this.nls.wabversionmsg + ': ' + this.manifest.wabVersion;
            msgStr += '\n' + this.manifest.description;
            new Message({
              titleLabel: this.nls.widgetversion,
              message: msgStr
            });
          }
        })));

        this.popup = this.map.infoWindow;

        this.zt = domConstruct.toDom('<a title="Zoom" to="" class="action zoomTo" href="javascript:void(0);"><span>' +
                                    esriBundle.widgets.popup.NLS_zoomTo + '</span></a>');
        domConstruct.place(this.zt, this.actionsListDiv);

        var link = domConstruct.create("a",{
          "class": "action",
          "id": "statsLink",
          "innerHTML": "Population", //text that appears in the popup for the link
          "href": "javascript: void(0);"
        }, this.actionsListDiv);

        //when the link is clicked register a function that will run
        on(link, "click", lang.hitch(this, this.calculatePopulation));

        this.clearSel = domConstruct.toDom('<a title="' + this.nls.clearseltip +'" to="" class="action clearSel" href="javascript:void(0);"><span>' + this.nls.clearsel + '</span></a>');
        domConstruct.place(this.clearSel, this.actionsListDiv);
        topic.subscribe("widgetsActionsRegistered", lang.hitch(this, this._onWidgetsActionsRegistered));
        this._createPopupMenuButton();
        this.setEvtHandlers();
        this.onWindowResize();
      },

      calculatePopulation: function(){
        var feature = this.popup.getSelectedFeature();
        console.info(feature);
        console.info("calc pop clicked")
      },
0 Kudos
LesiMai3
Deactivated User

Thank you Robert!

0 Kudos