Select to view content in your preferred language

Capture and Display Index

454
1
07-03-2014 10:38 AM
jaykapalczynski
Honored Contributor
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"));

         });

}
0 Kudos
1 Reply
jaykapalczynski
Honored Contributor
I see in some examples where it says 1 of 3 etc as the user scrolls through the selected list....but I cannot find the exact code in the examples as it seems a function of the widget
0 Kudos