0

I've been messing around with linking up a dgrid to select a feature layer and then fire an info template.

When it fires, it removes the selected point feature. Right now I have it set to when you click on the objectID in the 'ID' field of the dgrid it will select the feature.

Can view here on fiddle: http://jsfiddle.net/t2xan9pL/

1

selectFeatures method of a featureLayer is designed for use with a combination base dynamic layer. It is useful when you want few graphics on the maps. When doing so, usually the featureLayer is started in the SELECTION mode.

In your case use a QueryTask similar to the function populateGrid. Here is the working code

function selectK12(e) {
        // select the feature
        var qt = new QueryTask(window.k12URL); 
        var query = new Query();
        query.outFields = ["*"];
        query.returnGeometry = true;
        query.objectIds = [parseInt(e.target.innerHTML, 10)];

        distanceK12.queryFeatures(query, function (results) {    
         var firstFeature = results.features[0];
         window.map.infoWindow.hide();
         window.map.infoWindow.clearFeatures();
         window.map.infoWindow.show(firstFeature.geometry);         
         window.map.infoWindow.setFeatures([firstFeature]);
         window.map.centerAt(firstFeature.geometry);           
        });
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.