Open PopupPanel Widget from Custom Widget

993
6
Jump to solution
06-30-2021 01:24 AM
KafilBaig
New Contributor III

In my custom widget i have a datagrid and on row click i am showing the location and infowindow on map. Whereas When popupPanel is set to openAtStart: true then the infowindow is not displayed.

This issue is happening with Query widget also when we search and click on location the infowindow is not displayed.

What code changes needs to be done to display the Infowindow content in PopupPanel from all custom widget and query widget.

Appreciate your help in Advance.

Regards,

Kafil

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

OK, so what you want to do then is to add a PopupTemplate to your graphic then. Some code like this and your custom code/widget will use the Popup Panel widget instead:

//define a popup template
var popupTemplate = new PopupTemplate({
  title: "{title}",
  description: "{description}"
});

var graphic = new Graphic(point,symbol,null,popupTemplate);

this.map.infoWindow.setFeatures([graphic]);this.map.infoWindow.show(point)‍‍;

View solution in original post

6 Replies
RobertScheitlin__GISP
MVP Emeritus

@KafilBaig  Not showing the standard popup is by design. Why would you have the same info displayed in the maps popup and the popup widget at the same time? Anyway the widget.js is pretty clearly marked where the maps popup is hidden. It even has the comment .

        //hide the standard esri popup instead
        html.addClass(query('.esriPopup')[0], 'myPopupHidden');
KafilBaig
New Contributor III

@RobertScheitlin__GISP I don’t want to show infowindow and popup panel widget at the same time . My query is instead of default info window how should I call the custom popup panel widget from my custom widget to display the content .
 

 

0 Kudos
KarenRobine1
New Contributor III

Check out the infoWindow events. I just wrote this code for something I was doing.

uses  'dojo/_base/connect',

this._onSetFeaturesEvt = connect.connect(this._map.infoWindow"onSetFeatures", lang.hitch(this, this.processIdentify));
It might not be this exact event but probably something to allow the InfoWindow to open.
I also see a setFeatures() for InfoWindow:  ie. his._map.infoWindow.setFeatures(this._singles);
I also see that you can setup a graphic Layer onClick event
Hopefully this will get ya heading in the right direction.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

@KarenRobine1 You should be careful about using code that has been depreciated. 'dojo/_base/connect' is one of those that has been depreciated for many years. If you are still using it then you really need to update your code to use dojo/on.

0 Kudos
KarenRobine1
New Contributor III

Hah hah. Thanks Robert. That's what I get for grabbing code from another application I developed years ago. I will change it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

OK, so what you want to do then is to add a PopupTemplate to your graphic then. Some code like this and your custom code/widget will use the Popup Panel widget instead:

//define a popup template
var popupTemplate = new PopupTemplate({
  title: "{title}",
  description: "{description}"
});

var graphic = new Graphic(point,symbol,null,popupTemplate);

this.map.infoWindow.setFeatures([graphic]);this.map.infoWindow.show(point)‍‍;