Select to view content in your preferred language

Possible Bug in Flex Viewer 3.3, Editing and Searching

2062
1
05-31-2013 06:24 AM
TimDine
Occasional Contributor II
Open the flex viewer.  Open the edit widget.  You can edit.
Open the flex viewer.  Open the search widget.  You can search.
Open the flex viewer.  Open the edit widget.  Open the search widget.  You can edit.  You can search.
Open the flex viewer.  Open the search widget.  Open the edit widget.  Edit widget is broken.
Open the flex viewer.  Open the search widget.  Do a search.  Open the edit widget. You can edit.

I am using the uncompiled flex viewer 3.3 pulled from GitHub.  I haven't merged changes for a couple weeks.

It appears to be an issue with a feature layer being added to the viewer by the search widget that is totally null in it's attributes until a search is completed.  The edit widget makes it though this section of code gracefully, but returns without going through all the layers since the first one it finds is null (url=null, loaded=null, loadfault=null).

                    var layer:Layer = arrLayers[index] as Layer;
                    if (layer.loaded)
                    {
                        if ((layer is FeatureLayer && layer.name.indexOf("hiddenLayer_") == -1) && FeatureLayer(layer).isEditable && !FeatureLayer(layer).featureCollection)
                        {
                            layer.removeEventListener(FeatureLayerEvent.SELECTION_COMPLETE, featureLayer_selectionComplete);
                            layer.addEventListener(FeatureLayerEvent.SELECTION_COMPLETE, featureLayer_selectionComplete, false, 1);
                            featureLayers.push(layer);
                            arrFinalLayers.push(layer);

                            index++;
                            getAllFeatureLayers(index, featureLayers);
                        }
                        else if (layer is ArcGISDynamicMapServiceLayer && layer.name.indexOf("hiddenLayer_") == -1)
                        {
                            createFeatureLayersFromDynamicMapService(ArcGISDynamicMapServiceLayer(layer), index);
                        }
                        else
                        {
                            index++;
                            getAllFeatureLayers(index, featureLayers);
                        }
                    }
                    else if (layer.loadFault)
                    {
                        index++;
                        getAllFeatureLayers(index, featureLayers);
                    }
                    else
                    {
                        // listen for load
                        layer.addEventListener(LayerEvent.LOAD, layerLoadHandler);
                    }


Can anyone else duplicate this behavior?  I noticed it because I have a custom search widget that gets loaded during the initial load app the app (preload=open) and just added the edit widget to my viewer and it broke my workflow.

If this is a problem my personal suggestion would be to fix this in the edit widget so that it can continue on past this bad layer.  My first attempt at a quick fix is to add one more else if block to continue checking layers if you still have more to go.  Not sure if it fits the logic, but works with very preliminary testing.

     else if (index < arrLayers.length-1)
     {
      index++;
      getAllFeatureLayers(index, featureLayers);
     }
Tags (2)
0 Kudos
1 Reply
CarrieDavis
Occasional Contributor
Hi,

In reply to "Can anyone else duplicate this behavior? I noticed it because I have a custom search widget that gets loaded during the initial load app the app (preload=open) and just added the edit widget to my viewer and it broke my workflow."

It is possible you are experiencing an issue that has been corrected as of version 3.5, where if the Search widget is set to preload when opening the FlexViewer then the feature template for the edit wiget will not display.  I would suggest to try upgrading to version 3.5 or 3.6 to see if this corrects the issue.
0 Kudos