I am curious is there is a simple way to turn off the default "No Information Available" popup when clicking somewhere on a map where there is no spatial data (other than the basemap), or if clicking on a polygon that does not have popups enabled.
In an attempt to remove the popup, I commenting out the line in the code in the /client/builder/nls/main_en.js (line 593) and main_ROOT.js (line 666) files where:
NLS_noInfo : "No information available"
(These two .js files are the only ones with the text "No information available" exists in overall /webappbuilder directory). However this doesn't stop the popup.
I am using WAB 1.2 Developer's Edition on my computer with layers hosted through ArcGIS Online.
Solved! Go to Solution.
It is possible to change the text displayed for 'no information available' areas (the default popup for features that don't have popups enabled and for areas outside of any feature on the basemap).
You need to change 3 lines of code in the \server\apps\(app_id)\jimu.js file:
This way I could change the 'no information available' popup text to something a little less ambiguous.
At this time I cannot find a way to fully disable popups for 'no information available' areas.
It is possible to change the text displayed for 'no information available' areas (the default popup for features that don't have popups enabled and for areas outside of any feature on the basemap).
You need to change 3 lines of code in the \server\apps\(app_id)\jimu.js file:
This way I could change the 'no information available' popup text to something a little less ambiguous.
At this time I cannot find a way to fully disable popups for 'no information available' areas.
Thanks to Matiss for solving this problem. A recent update of ArcGIS Online (June 2017) meant that an update was required in my code.
I created a web app using Web App Builder in ArcGIS Online & exported code to a web server.
I updated the file jimu.js\main.js as follows :
immediately after the line :
console.log("jimu.js init...");
I inserted the line :
G.bundle.widgets.popup.NLS_noInfo = "<My popup message for no info>";
(No changes to the define list are now required)
See also Default API Strings | Guide | ArcGIS API for JavaScript 3.20 for some background.
if it's useful, this is how it is done with WABde and the result is more of what is expected from the OP. that no popup container shows up at all if there is no information when the action click occurs.
File: Server\apps\##\jimu.js\utils.js
'dojo/aspect'
...
add aspect to the function()
...
add the following lines (location in code in image)
// hide the info window popup by default
html.setStyle(map.infoWindow.domNode, "visibility", "hidden");
aspect.before(map.infoWindow, "setContent", function(method, args){
// show the info window if there are features, otherwise hide it
html.setStyle(map.infoWindow.domNode, "visibility", map.infoWindow.features ? "visible": "hidden");
});
Michael Robb - Glad that Robert Scheitlin, GISP pointed me to this page. I tried the above edit in jimu.js/utils.js and it saved the day! In fact, I had to add all of the below because part of what you're showing up there was not present. (I'm on WAB 2.16)
mo.createWebMap = function( ...
def.then(function(response) {
var map = response.map;
var handle = query(".title",map.infoWindow.domNode)[0];
var dnd = new Moveable(map.infoWindow.domNode,{
handle:handle
});
// hide the info window popup by default
html.setStyle(map.infoWindow.domNode, "visibility", "hidden");
aspect.before(map.infoWindow, "setContent", function(method, args){
// show the info window if there are features, otherwise hide it
html.setStyle(map.infoWindow.domNode, "visibility", map.infoWindow.features ? "visible": "hidden");
});
});
return def;
};
Also, I had to bring in Moveable..
define([
'dojo/aspect',
'dojo/dnd/Moveable',
... ],
function(aspect,Moveable,... )
Anyway, glad I found this, and thanks again to both of you!