schlot

Mobile Find Nearby location - problems with feature.selectFeatures in IE8

Discussion created by schlot on Oct 25, 2012
Latest reply on Nov 13, 2012 by schlot
I am working through the Find Nearby Location example, changing it for my services and also allowing the user to enter an address if they don't have geoLocation enabled.

This works fine in Firefox.  The user enters their address, then chooses which feature they want to find near that address.  If I try this in IE, adding a breakpoint in the featureLayer.selctFeatures function, I can add a watch on features and see there are several items in that array.  
 featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW, function(features){
                    var itemList = dijit.byId('searchResults');
                    //Remove any existing items from the result window
                    while (itemList.domNode.hasChildNodes()) {
                        itemList.domNode.removeChild(itemList.domNode.lastChild);
                    }
                    //If no results are found users should increase search distance
                    if(features.length === 0){
                            var noResults = new dojox.mobile.ListItem({
                            label: "No Results"
                        });
//breakpoint inserted here
                        noResults.set("class", "mblVariableHeight");
                        noResults.domNode.innerHTML = "No results found within search radius. Use the settings option to increase the search distance.";
                        itemList.addChild(noResults);
                        return;
                    }

It gets past (features.length === 0) and moves to the dojo.forEach loop which comes immediately after :

 dojo.forEach(features, function (feature) {
                        feature.distance = Math.round((esri.geometry.getLength(feature.geometry, currentGraphic.geometry) / 1609.344) * 100) / 100;
                    });
           

Here it fails.  When I look at the watch on features, once I'm in the line dojo.forEach , instead of having content, suddenly it is an empty array.     At first I thought it was having trouble with the calculation of the distance, but it doesn't seem to even be entering this loop since it doesn't think there's any features to loop through.  This doesn't happen in Firefox, only in IE (testing on IE 8).

Attachments

Outcomes