AnsweredAssumed Answered

Lang.Hitch selectFeatures in featureCollection

Question asked by mygis2t on Oct 24, 2017
Latest reply on Oct 24, 2017 by rscheitlin

I have these codes.  I'm wondering how do I use Lang.Hitch for this because of this error TypeError: Cannot read property 'selectFeatures' of undefined.

 

function CreateGraphics (evt) {

CODES HERE.......................

var graphics5= new Graphic(geoBuffer, symbolBuffer, attr5, infoTemplate5);
//map.graphics.add(graphics5);
ShowSelectedFeatures (graphics5);
}

/////////////////////////////////////////////////////////////////////////////////////

function ShowSelectedFeatures(graphicsLine) {

var featureCollection = {
"layerDefinition": null,
"featureSet": {
"features":graphicsLine,
"geometryType": "esriGeometryLine"
}
};

featureCollection.layerDefinition = {
"geometryType": "esriGeometryLine",
"objectIdField": "ObjectID",

"fields": [{
"name": "ObjectID",
"alias": "ObjectID",
"type": "esriFieldTypeOID"
}]
};


// Create a new feature layer
var FLayer = new FeatureLayer(featureCollection, {
mode: FeatureLayer.MODE_SELECTION,
outFields: ["*"],
infoTemplate: infoTemp
});

FLayer.setSelectionSymbol(lineSymb);
map.addLayer(FLayer);

}


//////////////////////////////////////////////////////////////////////////////////////

FLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (evt) {

CODES HERE .................................

});

Outcomes