Identify dijit

639
3
04-12-2010 08:07 PM
azzamwahab
New Contributor II
I download identify dijit sample from code gallery and tested okay.I want to add a button where it will only enable identify dijit when the button is clicked.Please help.

Following is the idea:

----
--------
----------
function btnEnable(val) {
identifyDijit = new dijits.identify.Indentify( { map: map } );

   if(val =="option 1"){
     identifyDijit.startup();
   }

   if(val=="option 2")(
     identifyDijit.destroy();
   }
}
0 Kudos
3 Replies
rajeshmanam
New Contributor
Hi,

does any one got any solution for this?

please share, how to enable or disable identify dijit as per user selection.

thanks in advance
0 Kudos
Kathleen_Crombez
Occasional Contributor III
I use dijit.form.ToggleButton.


dojo.require("dijit.form.ToggleButton");
var idStatus = false;


in the init() function:
dojo.connect(map, "onClick", function(evt) {
        mapPoint = evt.mapPoint;
        testIdentify(); 
    });


the buttons onClick:
onClick: function() { idStatus = !idStatus; idStatus ? map.setMapCursor("help") : map.setMapCursor("default"); }


function testIdentify(evt) {
    if (idStatus) {
       // do identify
    }
    return;
}
0 Kudos
DanielYim
New Contributor II
Thank you crombezk for pointing out the existence of a ToggleButton dijit! I have been using a very crude way of displaying the active tool on the toolbar before I saw your solution. It looks much more elegant now.

By the way, as per the Dojo API for this dijit, you only need to import the dijit.form.Button class to get the ToggleButton. You do not have to import that class alone.
0 Kudos