Selection Widget Updated Version

42349
146
05-12-2011 05:24 AM
MarkHoyland
Occasional Contributor II
The Selection widget has a "Select by Attributes" and "Select by Location" option similar to ArcGIS.
Widget link: http://www.arcgis.com/home/item.html?id=20ed6af9ab204548bbf092d51b51fef8

Version 1.5 of the widget replaces version 1.0

Enhancements and fixes include:
*Each time a query layer was added it was also being added to the TOC. This has been fixed.

*When resizing the widget, the datgrid would not resize properly. This has been fixed.

*Uses paging for selection of unique value list. This means that ALL values will be parsed regardless of the ArcGISServer setting to limit responses. There is an option to ESC out of a large query. (This is only for the Unique list, not getting features).
I have included an ESRI TaxParcel Layer that has 18,000+ records. Get Unique Values on the PSTLSTATE field to see this in action.
Available on my example site. The URL is on the Widget download page.

*Aliases can now be used. It will now use the Alias as set in the Featureclass. You can also override the Alias in the SelectionWidget.xml config file.

*ArcGis layers that have joined tables will now work with fully qualified field names. (thanks Dasa for the idea)

*Styling for selection colours has been documented in the SelectionWidget.xml config file (example provided).

*Styling for datagrid has been changed. It can now also be styled in SelectionWidget.xml config file (example provided). (thanks Mehul for the idea)

*Changed initial uniquevalue query to use "text='%'" instead of "where '1=1'" for Mike.:)

*You can now override scale range for layers.

*Link field now has a prefix/suffix option in the SelectionWidget.xml config file (naming convention the same as Robert SCheitlin's esearch widget)

*Shape_area and Shape_length can be used in the fields.

Link to previous thread :http://forums.arcgis.com/threads/24151-Selection-Widget-for-SFV2.2-(with-a-query-builder)
Tags (2)
0 Kudos
146 Replies
JeffersonFerreira_Ferreira
New Contributor III
Dear Colleagues;

Please, let me ask you a question (apparently simple) about the Selection Widget. Maybe 'cause my "middle-of-the-road" english understanding or 'cause the lack of familiarity with sql spatial operators, Im facing difficulties to distinguish between "that are completely within" and "that are is (fully) inside". For me this statement appear to have a grammatical error in "that are is...". I've searched a lot at the internet but cant find this specifically issue. If you could clarify me I'll be grateful.

Thanks
0 Kudos
JeffersonFerreira_Ferreira
New Contributor III
Hi all;

No problems with the operation of the tool. However when we opened for the first time an error message appears. The Error #2124 window appear (see attached file), then we close and the tool works normally. What could be happen? Any suggestions?
0 Kudos
RhettZufelt
MVP Frequent Contributor
I am trying to get the selection outline color to match that of my eSearch widget.  The coding is very similar, but does not seem to work correctly in the SelectionWidget.

If I don't change it in the config.xml or hard code in the mxml, I get the default browinish color.  If I change it in the config.xml or the mxml, it turns to a green color, no matter what I set it to (red, black, white, etc. always is the same green color).  In the eSearch widget I set it to 0x00FFFF and get a nice light blue outline.

Has anyone figured out how to make this change "take effect" in the SelectionWidget?

Any ideas,

R_
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   This is because the selection widget uses a feature layer in selection mode and the default selectioncolor is yellow which is applied as a filter that blends with the symbol color. To fix this just make these changes in the selection widget:

//New function
            private function removeGlow( fl:FeatureLayer ):void
            {
                var len:int = fl.numChildren;
                var dObj:DisplayObject;
                for ( var i:int = 0; i < len; i++ ) {
                    dObj = fl.getChildAt( i );
                    if ( dObj.filters ) {
                        dObj.filters = [];
                    }
                }
            }
            //Updated function
            protected function featureLayer_selectionHandler(event:FeatureLayerEvent):void
            {
                removeGlow(event.featureLayer);
                
                dispatchEvent( new Event( 'featurelayer_selection', true ) );
                
                var flEvent:SelectionFeatureLayerEvent = new SelectionFeatureLayerEvent(
                    SelectionFeatureLayerEvent.LAYER_RESULTS,event.featureLayer);
                dispatchEvent(flEvent);
                
                if (event.type == FeatureLayerEvent.SELECTION_CLEAR)
                {
                    this.showInfoWindow(null);
                }
                
            }
0 Kudos
RhettZufelt
MVP Frequent Contributor
Thanks again Robert, works like a charm.

No wonder I couldn't figure it out.  Guess I should have tried a color that blends with yellow to make cyan 🙂

R_
0 Kudos
MikeDahm
Occasional Contributor
Any plans for this widget to be updated for Flexviewer 3.0?
0 Kudos
JeffersonFerreira_Ferreira
New Contributor III
Anyone have an idea about the error #2124?
0 Kudos
RhettZufelt
MVP Frequent Contributor
I have updated this part of the init() function and it seems to be working fine in 3.0:  Keep in mind that I am no pro by any means, but this seems to work.

     for (var i:int = 0; i < lyrList.length(); i++)
     {
      var lyrURL:String = lyrList.url;
      var lyrLabel:String = lyrList.name;
      
      var featureLayer:FeatureLayer = new FeatureLayer(lyrURL);
      featureLayer.name = lyrLabel;
      var l1lst:XMLList = (lyrList.maxscale as XMLList)
      var l2lst:XMLList = (lyrList.minscale as XMLList)
      
      //Override the min and max zoom scale if they are in the config   // not sure why couldn't test directly but had to create varable first???
      if (l1lst.length() > 0 )
       featureLayer.maxScale = lyrList.maxscale;
      if (l2lst.length() > 0 )
       featureLayer.minScale = lyrList.minscale;
      
      featureLayer.addEventListener(LayerEvent.LOAD, featureLayer_loadHandler);
     }
     
.........
........
........
     //ViewerContainer.dispatchEvent(new AppEvent(AppEvent.DATA_CREATE_INFOWIDGET, data, infoReady));
     AppEvent.dispatch(AppEvent.DATA_CREATE_INFOWIDGET, data, infoReady);


I still get a couple warnings about "Data binding will not be able to detect assignments to length" for the end of SelectByAttributes.mxml and SelectionResults.mxml but it is working.

R_
0 Kudos
JeffersonFerreira_Ferreira
New Contributor III
I have updated this part of the init() function and it seems to be working fine in 3.0:  Keep in mind that I am no pro by any means, but this seems to work.

     for (var i:int = 0; i < lyrList.length(); i++)
     {
      var lyrURL:String = lyrList.url;
      var lyrLabel:String = lyrList.name;
      
      var featureLayer:FeatureLayer = new FeatureLayer(lyrURL);
      featureLayer.name = lyrLabel;
      var l1lst:XMLList = (lyrList.maxscale as XMLList)
      var l2lst:XMLList = (lyrList.minscale as XMLList)
      
      //Override the min and max zoom scale if they are in the config   // not sure why couldn't test directly but had to create varable first???
      if (l1lst.length() > 0 )
       featureLayer.maxScale = lyrList.maxscale;
      if (l2lst.length() > 0 )
       featureLayer.minScale = lyrList.minscale;
      
      featureLayer.addEventListener(LayerEvent.LOAD, featureLayer_loadHandler);
     }
     
.........
........
........
     //ViewerContainer.dispatchEvent(new AppEvent(AppEvent.DATA_CREATE_INFOWIDGET, data, infoReady));
     AppEvent.dispatch(AppEvent.DATA_CREATE_INFOWIDGET, data, infoReady);


I still get a couple warnings about "Data binding will not be able to detect assignments to length" for the end of SelectByAttributes.mxml and SelectionResults.mxml but it is working.

R_




Is it for the error #2124??
0 Kudos
RhettZufelt
MVP Frequent Contributor
I do not get any errors.  Just a few warnings about length not being bindable.

R_
0 Kudos