Adding Closable to InfoWindow
ESRI uses "hide" style to indicate the x in the corner of the infoWindow to dismiss/hide the infoWindow. If another .CSS gives meaning to "hide", such as display: none, then that little X will no longer appear in the infoWindow.
The problem with this is that esri.dijit.InfoWindow does not implement support for "closable".
Solution
coretech.ext.makeInfoWindowClosable = function(p) {
var a = "closable",
infoWindow = p.prototype;
an = infoWindow._getAttrNames(a);
infoWindow[an.s] = function(value) {
this[a] = value;
dojo.query(".user .titlebar .hide", this.domNode).forEach(function(n) {
dojo.style(n, {
display: value ? "block" : "none"
});
});
};
infoWindow[an.g] = function() {
return this[a];
};
};
coretech.ext.makeInfoWindowClosable(esri.dijit.InfoWindow);
Usage Example
var o = coretech.esriMap.infoWindow;
o.set("closable", false);
o.show(coretech.esriMap.extent.getCenter());
No comments:
Post a Comment