How can I remove the ability to click any where on the map (i.e., where there is no data)?

918
8
Jump to solution
09-12-2017 10:39 PM
MelissaTraverso
New Contributor III

A user is able to click anywhere on the map. Is it possible to just allow the ability to click only on the data points? I have pop-up windows with information pertaining to each data point. A miss-click (i.e., not on a data point) returns  "no information available" and this has been reported as confusing based on feedback I've received so far. 

Thanks,

Melissa 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Melissa,

  Sure you can do that to by editing the APIs default strings:

require(["dojo/i18n!myApp/nls/jsapi"], function(myStrings){
  myStrings.widgets.popup.NLS_noInfo = "blah blah";
});

You should be sure to mark your questions as answered once the original question has been answered.

View solution in original post

8 Replies
RobertScheitlin__GISP
MVP Emeritus

Melissa,

   There is no good way to completely remove the popup when there is no data. But this change will only briefly flash the popup as it is searching for whether data does intersect the clicked point:

In the jimu.js/PopupManager.js add lines 7 and 8:

      init: function() {
        this.popupUnion = this.mapManager.getMapInfoWindow();
        if(!this.popupUnion.bigScreen || !this.popupUnion.mobile ||
          !this.popupUnion.bigScreen.domNode || !this.popupUnion.mobile.domNode){
          return;
        }
        this.popupUnion.bigScreen.visibleWhenEmpty = false;
        this.popupUnion.bigScreen.hideDelay = 0;
        if(!this.isInited){
          this._createPopupMenuButton();
          this._bindSelectionChangeEvent();
          this.isInited = true;
        }
      },

 

MelissaTraverso
New Contributor III

Hi Robert,

Thanks! I will test this out. Another idea is, instead of it saying "no information available", can I customize it to read..."not a data point" or something a little bit more geared toward my data. 

Thanks,

Melissa

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Melissa,

  Sure you can do that to by editing the APIs default strings:

require(["dojo/i18n!myApp/nls/jsapi"], function(myStrings){
  myStrings.widgets.popup.NLS_noInfo = "blah blah";
});

You should be sure to mark your questions as answered once the original question has been answered.

MelissaTraverso
New Contributor III

Hi Robert,

Will do! I am still having issues with customizing the filter widget but plan to mark it all as answered when I get it figured out

Thanks,

Melissa

0 Kudos
MelissaTraverso
New Contributor III

Hi Robert- where can I find the APIs default strings ?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

By adding the require to your code as I have shown above.

0 Kudos
MelissaTraverso
New Contributor III

I suppose I was hoping to seek more information on where to properly add the require. I have tried to add it it in a couple of different places within jimu.js/PopupManager.js. When I got to WAB the map doesn't appear and my browsers console reads:

I apologize for being so inexperienced, I appreciate your patience.

Thanks.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Melissa,

Here is what you need to add to the PopupManager.js (lines 27, 29 and 51):

///////////////////////////////////////////////////////////////////////////
// Copyright © 2015 Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
define([
  'dojo/_base/declare',
  'dojo/_base/lang',
  'dojo/_base/html',
  'dojo/topic',
  'dojo/on',
  'dojo/query',
  './FeatureActionManager',
  './utils',
  './dijit/FeatureActionPopupMenu',
  './RelatedRecordsPopupProjector',
  'dojo/i18n!esri/nls/jsapi'
  ], function(declare, lang, html, topic, on, query, FeatureActionManager, jimuUtils, PopupMenu,
  RelatedRecordsPopupProjector, esriBundle) {
    var instance = null;
    var clazz = declare(null, {
      mapManager: null,
      // popupUnion = {
      //   mobile: is mobile popup of map,
      //   bigScreen: is popup of map
      // };
      popupUnion: null,
      _relatedRecordsPopupProjector: null,

      constructor: function(options) {
        lang.mixin(this, options);

        this.popupMenu = PopupMenu.getInstance();
        this.isInited = false;

        this.featureActionManager = FeatureActionManager.getInstance();
        topic.subscribe("mapLoaded", lang.hitch(this, this.onMapLoadedOrChanged));
        topic.subscribe("mapChanged", lang.hitch(this, this.onMapLoadedOrChanged));
        topic.subscribe("appConfigChanged", lang.hitch(this, this._onAppConfigChanged));
        topic.subscribe("widgetsActionsRegistered", lang.hitch(this, this._onWidgetsActionsRegistered));
        esriBundle.widgets.popup.NLS_noInfo = "blah blah";
      },