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
Solved! Go to Solution.
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")
},
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")
},
Thank you Robert!