+ Reply to Thread
Results 1 to 4 of 4

Thread: FeatureLayer bug when removing from map and adding back

  1. #1
    Christian Morin
    Join Date
    Dec 2009
    Posts
    13
    Points
    2
    Answers Provided
    0


    0

    Default FeatureLayer bug when removing from map and adding back

    I have an application that removes a FeatureLayer from the map using map.removeLayer. Later on I add it back to the map. It shows up on the map, but if I call the featureLayer.selectFeatures on the layer it fails (never calls the callbacks).

    Stepping through the API I can see that the private variable _mode on the featureLayer is set to null when the layer is removed from the map, but never re-assigned when put back in the map. The selectFeatures code expects the _mode variable to be set. I believe this is a bug in the API.

    Cheers,
    Christian.

  2. #2
    Derek Swingley

    Join Date
    May 2010
    Posts
    1,859
    Points
    893
    Answers Provided
    165


    0

    Default Re: FeatureLayer bug when removing from map and adding back

    Hi Christian,

    Can you provide code to reproduce this?
    --
    @derekswingley | ArcGIS API for JavaScript Team Member.

    If you're posting a code or html sample, please wrap it in code tags.

  3. #3
    Jeff Pace
    Join Date
    Jun 2010
    Posts
    911
    Points
    252
    Answers Provided
    38


    0

    Default Re: FeatureLayer bug when removing from map and adding back

    Do you have an Editor dijit associated with this Feature Layer ? I ran into alot troubles with removing and readding a Feature Layer when it was a child of a dijit.

    I found that after removing the layer, if i destroyed dijit as well, all my problems went away

    so

    Code:
    editorWidget = new esri.dijit.editing.Editor(params,'editorDiv');
    
    //on remove
    map.removeLayer(layer);
    editorWidget.destroy();

  4. #4
    Christian Morin
    Join Date
    Dec 2009
    Posts
    13
    Points
    2
    Answers Provided
    0


    0

    Default Re: FeatureLayer bug when removing from map and adding back

    Hi Derek,
    I've taken the On Demand sample from your site and added 2 buttons. One that will perform a query on the feature layer. The other will remove then add back the layer to the map.

    If you run the query first it will work. Then, if you remove/add the layer from the map, the query will not return at all (not success or failure).

    I've also put some alerts to show what the problem is (the internal _mode property gets cleared in the process of remove/add) and this code fails silently in your API when queryFeatures is called on the feature layer.

    Cheers,
    Christian.
    Attached Files

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts