jay.kapalczynski

Identify From Button

Discussion created by jay.kapalczynski on Apr 16, 2014
Latest reply on Aug 8, 2014 by MayMay
Identify from Button
I was on here working out a solution to fire some code that did a buffer and selection of features within and return to a grid. That works, but I now have a button that I want to run an identify and send results to a side bar. I believe the code is in place to pause the buffer code when switching between buttons.
But the way I have it set up below its requiring a click event on the map to start running the Identify code...if I click a feature in the map it does not run the code. So I am confused on how to start the Identify

Trying to call the identify sidebar code in red
the blue is where I am seeing a required map click to run the code...but it does not fire when I click a feature I want to identify on.

When I click the map I am not even getting to the Function and the alert.... alert("In SidebarApp");

Thoughts?
Thanks

   
        on(dojo.byId('Identify'), "click", function () {

         if (Buffer != undefined) {
             Buffer.pause();
         }
         if (Identify == undefined) {
             Identify = on.pausable(app.map, "click", function (evt) {
   
   initializeSidebar(map);
             });
         }
         else {
             Identify.resume();
         }
    });





// SIDEBAR IDENTIFY START


    function initializeSidebar(map){

alert("In SidebarApp");


        var popup = map.infoWindow;

        //when the selection changes update the side panel to display the popup info for the
        //currently selected feature.
        connect.connect(popup, "onSelectionChange", function(){
            displayPopupContent(popup.getSelectedFeature());
        });

        //when the selection is cleared remove the popup content from the side panel.
        connect.connect(popup, "onClearFeatures", function(){
           //dom.byId replaces dojo.byId
           dom.byId("featureCount").innerHTML = "Click to select feature(s)";
           //registry.byId replaces dijit.byId
           registry.byId("leftPane").set("content", "");
           domUtils.hide(dom.byId("pager"));
        });

        //When features are associated with the map's info window update the sidebar with the new content.
        connect.connect(popup, "onSetFeatures", function(){
           displayPopupContent(popup.getSelectedFeature());
           dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";

       //enable navigation if more than one feature is selected
       popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));
         });
       }

    function displayPopupContent(feature){
       if(feature){
           var content = feature.getContent();
           registry.byId("leftPane").set("content", content);
       }
    }

    function selectPrevious(){
       map.infoWindow.selectPrevious();
    }

    function selectNext(){
       map.infoWindow.selectNext();
    }

    function clearContent() {
       registry.byId("leftPane").set("content", "");
       domUtils.hide(dom.byId("pager"));
    }

Outcomes