I can't understand how to display all features from the feature layer. In the code bellow I specified 2 features in the layer and set in feature layer's mode to esri.layers.FeatureLayer.MODE_SNAPSHOT. According esri documentation this options means that all features will be selected and displayed. But they are not. The code is:
var jsonFS = {
"displayFieldName": "Name",
"fieldAliases": {
"Name": "Name"
},
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100 //WGS_1984_Web_Mercator_Auxiliary_Sphere
},
"fields": [{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
"length": 255
}],
"features": [{
"attributes": {
"Name": "bla"
},
"geometry": {
"x": -8919439.31450887,
"y": 4928270.761925456
}
},
{
"attributes": {
"Name": "bla bla"
},
"geometry": {
"x": -8155495.379532158,
"y": 5075380.311392084
}
}]
};
var fs = new esri.tasks.FeatureSet(jsonFS);
var featureCollection = {
layerDefinition: {
"geometryType": "esriGeometryPoint",
"fields": [
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name"
}
]
},
featureSet: fs
};
var featureLayer = new esri.layers.FeatureLayer(featureCollection, {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT
});