Select to view content in your preferred language

Web Appbuilder: "No Information Available" popup

4819
4
Jump to solution
11-03-2015 08:51 AM
MatissValdmanis1
Occasional Contributor

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.

popupNoInfoAvailable.PNG

Tags (2)
1 Solution

Accepted Solutions
MatissValdmanis1
Occasional Contributor

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:

  • at (or near) line 38, add 'dojo/i18n!esri/nls/jsapi' to the end of the “define” list (make sure you add the comma on the line above)
  • at (or near) line 43, add “, esriBundle” to the “function” parameters
  • at (or near) line 152, add the following line (with no comma or semicolon) after the "console.log('jimu.js init...');" line, in the initApp() function:
    • esriBundle.widgets.popup.NLS_noInfo = "<your popup text here>"

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.

View solution in original post

4 Replies
MatissValdmanis1
Occasional Contributor

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:

  • at (or near) line 38, add 'dojo/i18n!esri/nls/jsapi' to the end of the “define” list (make sure you add the comma on the line above)
  • at (or near) line 43, add “, esriBundle” to the “function” parameters
  • at (or near) line 152, add the following line (with no comma or semicolon) after the "console.log('jimu.js init...');" line, in the initApp() function:
    • esriBundle.widgets.popup.NLS_noInfo = "<your popup text here>"

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.

JohnGibson2
Occasional Contributor

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.

MichaelRobb
Honored Contributor

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");

});

Arne_Gelfert
Frequent Contributor

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!