jay.kapalczynski

Capture and Display Index

Discussion created by jay.kapalczynski on Jul 3, 2014
Latest reply on Jul 3, 2014 by jay.kapalczynski
I am usign the below code to return results to a popup.  When there is more than one features returned it reports how many were found

dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";

Additionally  it allows the user to scroll through the returned features

popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));



Right now it will return "5 Feature(s) selected"  As I scroll through the list their attributes are shown but nothing more.
My question is can I capture the index of the feature being displayed as the user scrolls through the returned features.

So it will still say "5 Feature(s) selected" and below that it will return the index number of the one being displayed.  As they move through the list that index number will update itself...

This possible?  If so How do I get the index value of the feature being displayed at that given time?


    function initializeSidebar(map){

        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("featureCount").innerHTML = "Looking for features";

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

         });

}

Outcomes