Select to view content in your preferred language

feature layer:selection mode and  snapshot mode difference?

4108
2
06-05-2012 07:24 PM
akpagaakpaga
Deactivated User
Hi friends

I am trying use the following samplehttp:
//help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ed_attribute_inspector.html

The problem..is that

when i change the feature layer  to my url like this, the feature points do not show on the base map.


        var petroFieldsFL = new esri.layers.FeatureLayer("http://test.com/ArcGIS/rest/services/Houston/Test/FeatureServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SELECTION,
          outFields: ["test1","objectid","Vacant"]
        });


But  when i change the mode:esri.layers.FeatureLayer.MODE_SNAPSHOT  , they show up.....what is the difference between the sample feature service and mine...
how can i get it work in selection mode


Thank  you in advance
0 Kudos
2 Replies
BenFousek
Deactivated User
I'm not sure if you're aware but the api reference (the tab right next to the samples tab) has a wealth of information. Here's what it says:

MODE_SELECTION 
In selection mode, features are retrieved from the server only when they are selected. Features are available on the client only while they are selected. To work with selected features:
    Call the selectFeatures method.
    Listen for the onSelectionComplete event.
    Once onSelectionComplete fires, retrieve the selected features using the getSelectedFeatures method.
When editing feature layers in selection mode, you will need to add the map service associated with the feature service to the map as a dynamic map service. After modifying features, listen for the onEditsComplete event and manually refresh the associated dynamic map service layer so the modified features are rendered. If you do not have the map service added as a dynamic map service then the changes will not be visible because once the edits are complete the feature is no longer selected.


MODE_SNAPSHOT
In snapshot mode, the feature layer retrieves all the features from the associated layer resource and displays them as graphics on the client. Definition expressions and time definitions are honored. The features are retrieved once the feature layer is added to the map. After the onUpdateEnd event has fired, you can access the features using the graphics property of the layer or through selection and query operations.


Nothing shows up in selection mode because you haven't selected any features. Note that it MODE_SELECTION requires you to add the layer as a dynamic layer too.
0 Kudos
akpagaakpaga
Deactivated User
Thank You Bfou for your response..

Got My feature points through MapServerice..
0 Kudos