Info Window - Version 3.4 of the JavaScript API

1255
8
Jump to solution
03-25-2013 12:06 PM
bobcarr
New Contributor III
From the 'What's New in Version 3.4 ', I read:

The popup widget is now the default info window for the map. Most ArcGIS API for JavaScript users prefer the popup's look and feel and, after some refactoring some internal dependencies, using the popup as the default makes sense. Additional changes to the popup include: easier to place the popup in a container outside the map, better support for right-to-left content and several new config options to control paging controls and how features are highlighted


Does having the popup as the 'default' mean that the previous info window provided by the esri.dijit.infowindow might still be available as an alternative?  If so, is it set within the map constructor? Looking through the map constructor options for Version 3.4, I see only the infoWindowBase option whose implementation seems to require a custom module.
0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor
Here's a code snippet showing how to use the old info window instead of the popup. Note that the sample points to esri.esri.dijit.InfoWindow at the next version of the api (3.5) we'll fix this so you just need to enter esri.dijit.InfoWindow.

 var map = new esri.Map("map", {   basemap: "streets",   center:  [-98.215, 38.382],   zoom:    7 });  var infoWindow = new esri.esri.dijit.InfoWindow({}, dojo.create("div", null, map.root)); infoWindow.startup(); map.setInfoWindow(infoWindow);

View solution in original post

0 Kudos
8 Replies
BillHoney
New Contributor III
I could do with some advise on the same subject.

Upgrading to 3.4 breaks my code, 
How do I either :
a) set the default infoWindow back to infoWindow type  or
b) upgrade my code to support popupWindow ?

I have a simple InfoWindow with html in it

whereAmIgraphic.setInfoTemplate(new esri.InfoTemplate("Location : ",
                    "<p>" +
                    "<div id='divXYInfo'></div>" +
                      ....
0 Kudos
SimonFisher
Occasional Contributor II
I would also like to know how to support the old info window.  Actually I would like to know how I can support both old and new in the same map?

To implement the new info window here is a good walk through;
http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/intro_agspopup.html

I don't see any 3.4 samples that show how to implement the old info window.
0 Kudos
SimonFisher
Occasional Contributor II
Anyone make any progress on this?
0 Kudos
KellyHutchins
Esri Frequent Contributor
Here's a code snippet showing how to use the old info window instead of the popup. Note that the sample points to esri.esri.dijit.InfoWindow at the next version of the api (3.5) we'll fix this so you just need to enter esri.dijit.InfoWindow.

 var map = new esri.Map("map", {   basemap: "streets",   center:  [-98.215, 38.382],   zoom:    7 });  var infoWindow = new esri.esri.dijit.InfoWindow({}, dojo.create("div", null, map.root)); infoWindow.startup(); map.setInfoWindow(infoWindow);
0 Kudos
LucasScharenbroich
Occasional Contributor
I just had to do this myself today.  Here's what I ended up with.  It creates the InfoWindow first and passes it via the Map constructor options rather than setting it after the map is created.  This assumes you have an element with an id of "map" in your DOM.

This may not be correct if the InfoWindow domNode really has to be attached to map.root.

define(["dojo/dom-construct", "esri/dijit/InfoWindow", "esri/map"],
    function(domConstruct, InfoWindow, Map) {
        var infoWindow = new InfoWindow({}, domConstruct.create("div", null, "map"));
        infoWindow.startup();
               
        var map = new Map("map", {
            infoWindow: infoWindow
        });
    }
);
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
I have tried using Kelly's suggestion above but I am getting the following error:
"SCRIPT5007: Unable to get value of the property 'dijit': object is null or undefined"
The error happens on the line that the infoWindow is being created.

my code:
   map = new esri.Map("mapDiv", {
             extent: initialExtent,
             logo: false,
             fadeOnZoom: true
             });
                   
          var infoWindow = new esri.esri.dijit.InfoWindow({}, dojo.create("div", null, map.root));
          infoWindow.startup();
          map.setInfoWindow(infoWindow);
0 Kudos
KellyHutchins
Esri Frequent Contributor
Hi Andrew,

Try adding a dojo.require to your app for the info window. For example:

dojo.require("esri.dijit.InfoWindow");


Kelly
0 Kudos
bobcarr
New Contributor III
Here's a code snippet showing how to use the old info window instead of the popup. Note that the sample points to esri.esri.dijit.InfoWindow at the next version of the api (3.5) we'll fix this so you just need to enter esri.dijit.InfoWindow.


var map = new esri.Map("map", {
  basemap: "streets",
  center:  [-98.215, 38.382],
  zoom:    7
});

var infoWindow = new esri.esri.dijit.InfoWindow({}, dojo.create("div", null, map.root));
infoWindow.startup();
map.setInfoWindow(infoWindow);


Thank you for posting this snippet.  Using this, our web map now displays the traditional infoWindow.
0 Kudos