Select to view content in your preferred language

Toolbar navigation "map.disableDoubleClickZoom is not a function"

600
4
01-29-2013 06:06 AM
DavidReeves
Occasional Contributor
Developing using ExtJS 4 and ArcGIS Javascript API v3.3

I am trying to implement a navigation toolbar similar to the one in this Esri sample:

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/toolbar_navigation

When I click a button to select a navigation tool, I receive this error in the console:

"TypeError: map.disableDoubleClickZoom is not a function"
(line 34 from http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3 is referenced)

Can anyone explain what might be causing this error?
0 Kudos
4 Replies
DianaBenedict
Frequent Contributor
David

Javascript is very unforgiving, you need to make sure to use the correct syntax. 

map.disableDoubleClickZoom();  

You need the parens at the end and don't forget the semicolon.

Hope this solves your issue. If not post some code so we can see what else might be causing it.

Diana Benedict
0 Kudos
derekswingley1
Deactivated User
In that sample, map is a global variable. Is map a global variable in the app your building?
0 Kudos
DianaBenedict
Frequent Contributor
Yes, true. That is assuming the following:
1) map is global variable (just like the samples)
2) the map has successfully loaded so that all the methods and properties are available
0 Kudos
DavidReeves
Occasional Contributor
Thank you for your responses.

map is a global variable
The map has successfully loaded and works fine.
The error appears when I click on the tool.

I've constructed a toolbar
Ext.define('app.view.mainToolbar',{
 extend: 'Ext.toolbar.Toolbar',
 alias: 'widget.mainToolbar',
 border: 0,
 items: [
  { itemId: 'zoomin', iconCls: 'icon-nav-zoomin', tooltip: 'Zoom In' },
  { itemId: 'zoomout', iconCls: 'icon-nav-zoomout', tooltip: 'Zoom Out' },
  { itemId: 'pan', iconCls: 'icon-nav-pan', tooltip: 'Pan' }
)};

and a controller to handle the clicks.
Ext.define('app.controller.toolbarController', {
  extend: 'Ext.app.Controller',
  init: function () {

    this.control({
      'mainToolbar > #zoomin': {
        click: this.ClickNavBtn
      },
      'mainToolbar > #zoomout': {
        click: this.ClickNavBtn
      },
      'mainToolbar > #pan': {
        click: this.ClickNavBtn
      }
    });
 },

///execute different methods of navToolbar(esri.toolbars.Navigation) depending on which button user has clicked
 ClickNavBtn: function (btn, e) {
    switch (btn.itemId) {
      case 'zoomin':
        app.map.navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);
        break;
      case 'zoomout':
        app.map.navToolbar.activate(esri.toolbars.Navigation.ZOOM_OUT);
        break;
      case 'pan':
        app.map.navToolbar.activate(esri.toolbars.Navigation.PAN);
        break;
    }
 }
});
0 Kudos