Search result symbols are not showing in 3.3 or 3.4

1288
8
Jump to solution
08-20-2013 06:56 AM
DanielJohns
Occasional Contributor
I'm in the process of updating our Flex 2.5 to 3.4, but after deploying the search widget (out-of-the-box) the graphic results are not showing in the result list or on the map. It will work in 2.5, but not in 3.3 or 3.4, I thought something may have changed. The sample on Esri's site doesn't work either, so is this an issue or the new norm?

The street center line is set to 100% transparency.

Thank you,
Daniel

[ATTACH=CONFIG]26818[/ATTACH]

 <?xml version="1.0" ?> <configuration>  <initialview>text</initialview>  <layers>   <layer>    <name>Clay County Road</name>    <url>http://server/server/rest/services/Layers/MapServer/102</url>    <expression>upper(FullName) LIKE upper('%[value]%')</expression>    <textsearchlabel>Search by Street Name [ Example: Old Jennings Rd or     Jennings ]</textsearchlabel>    <titlefield>FullName</titlefield>    <linkfield></linkfield>    <fields all="false">     <field name="FullName" alias="Street" />    </fields>    <orderbyfields>FullName ASC</orderbyfields>   </layer>   <layer>    <name>Bradford County Road</name>    <url>http://server/server/rest/services/Layers/MapServer/103</url>    <expression>upper(NAME) LIKE upper('%[value]%')</expression>    <textsearchlabel>Search by Street Name [ Example: State Road 100 or     100 ]    </textsearchlabel>    <titlefield>NAME</titlefield>    <linkfield></linkfield>    <fields all="false">     <field name="NAME" alias="Street" />    </fields>    <orderbyfields>NAME ASC</orderbyfields>   </layer>  </layers>  <zoomscale>10000</zoomscale>  <symbols>   <simplelinesymbol width="4" />  </symbols>  </configuration>  <!-- See Search widget documentation at http://links.esri.com/searchwidget -->
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   Wow, I had not noticed that... Well If you are using the source code then there is a simple fix for this:

Make the changes in red in the SearchWidget.mxml

            private function createSearchResults(featureSet:FeatureSet, queryFields:XMLList):ArrayCollection             {                 var result:ArrayCollection = new ArrayCollection();                  var layerDetails:LayerDetails = queryLayer.layerDetails;                 if (!queryTitleField)                 {                     queryTitleField = featureSet.displayFieldName;                 }                                  for each (var graphic:Graphic in featureSet.features)                 {                     var resultAttributes:ResultAttributes =                         ResultAttributes.toResultAttributes(queryFields, graphic, featureSet, queryLayer, layerDetails, widgetTitle, queryTitleField, queryLinkField, queryLinkAlias);                     setDefaultGraphicSymbol(graphic);                     var searchResult:ResultItem = new ResultItem(graphic, resultAttributes);                     result.addItem(searchResult);                      var infoWindowRenderer:ClassFactory = new ClassFactory(PopUpRenderer);                     infoWindowRenderer.properties = { popUpInfo: configurePopUpInfo(resultAttributes)};                     graphic.infoWindowRenderer = infoWindowRenderer;                 }                 resultFeatureLayer.outFields = queryLayer.outFields;                 resultFeatureLayer.visible = true;                 resultFeatureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);                                  switch (featureSet.geometryType)                 {                     case Geometry.MAPPOINT:                     {                         resultFeatureLayer.renderer = new SimpleRenderer(resultMarkerSymbol);                         break;                     }                     case Geometry.POLYLINE:                     {                         resultFeatureLayer.renderer = new SimpleRenderer(resultLineSymbol);                         break;                     }                     case Geometry.POLYGON:                     {                         resultFeatureLayer.renderer = new SimpleRenderer(resultFillSymbol);                         break;                     }                 }                                  return result;             }                          private function setDefaultGraphicSymbol(graphic:Graphic):void             {                 switch (graphic.geometry.type)                 {                     case Geometry.MAPPOINT:                     {                         graphic.symbol = resultMarkerSymbol;                         break;                     }                     case Geometry.POLYLINE:                     {                         graphic.symbol = resultLineSymbol;                         break;                     }                     case Geometry.POLYGON:                     {                         graphic.symbol = resultFillSymbol;                         break;                     }                 }             } 

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   Wow, I had not noticed that... Well If you are using the source code then there is a simple fix for this:

Make the changes in red in the SearchWidget.mxml

            private function createSearchResults(featureSet:FeatureSet, queryFields:XMLList):ArrayCollection             {                 var result:ArrayCollection = new ArrayCollection();                  var layerDetails:LayerDetails = queryLayer.layerDetails;                 if (!queryTitleField)                 {                     queryTitleField = featureSet.displayFieldName;                 }                                  for each (var graphic:Graphic in featureSet.features)                 {                     var resultAttributes:ResultAttributes =                         ResultAttributes.toResultAttributes(queryFields, graphic, featureSet, queryLayer, layerDetails, widgetTitle, queryTitleField, queryLinkField, queryLinkAlias);                     setDefaultGraphicSymbol(graphic);                     var searchResult:ResultItem = new ResultItem(graphic, resultAttributes);                     result.addItem(searchResult);                      var infoWindowRenderer:ClassFactory = new ClassFactory(PopUpRenderer);                     infoWindowRenderer.properties = { popUpInfo: configurePopUpInfo(resultAttributes)};                     graphic.infoWindowRenderer = infoWindowRenderer;                 }                 resultFeatureLayer.outFields = queryLayer.outFields;                 resultFeatureLayer.visible = true;                 resultFeatureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);                                  switch (featureSet.geometryType)                 {                     case Geometry.MAPPOINT:                     {                         resultFeatureLayer.renderer = new SimpleRenderer(resultMarkerSymbol);                         break;                     }                     case Geometry.POLYLINE:                     {                         resultFeatureLayer.renderer = new SimpleRenderer(resultLineSymbol);                         break;                     }                     case Geometry.POLYGON:                     {                         resultFeatureLayer.renderer = new SimpleRenderer(resultFillSymbol);                         break;                     }                 }                                  return result;             }                          private function setDefaultGraphicSymbol(graphic:Graphic):void             {                 switch (graphic.geometry.type)                 {                     case Geometry.MAPPOINT:                     {                         graphic.symbol = resultMarkerSymbol;                         break;                     }                     case Geometry.POLYLINE:                     {                         graphic.symbol = resultLineSymbol;                         break;                     }                     case Geometry.POLYGON:                     {                         graphic.symbol = resultFillSymbol;                         break;                     }                 }             } 
0 Kudos
DanielJohns
Occasional Contributor
Thank you Robert that worked it's now showing back up in the results list.

What about for features that are set as 100% transperant? It still doesn't display those symbols on the map (but it does show in the list); I've only tested polylines.


Daniel,

   Wow, I had not noticed that... Well If you are using the source code then there is a simple fix for this:

Make the changes in red in the SearchWidget.mxml

            private function createSearchResults(featureSet:FeatureSet, queryFields:XMLList):ArrayCollection
            {
                var result:ArrayCollection = new ArrayCollection();

                var layerDetails:LayerDetails = queryLayer.layerDetails;
                if (!queryTitleField)
                {
                    queryTitleField = featureSet.displayFieldName;
                }
                
                for each (var graphic:Graphic in featureSet.features)
                {
                    var resultAttributes:ResultAttributes =
                        ResultAttributes.toResultAttributes(queryFields, graphic, featureSet, queryLayer, layerDetails, widgetTitle, queryTitleField, queryLinkField, queryLinkAlias);
                    setDefaultGraphicSymbol(graphic);
                    var searchResult:ResultItem = new ResultItem(graphic, resultAttributes);
                    result.addItem(searchResult);

                    var infoWindowRenderer:ClassFactory = new ClassFactory(PopUpRenderer);
                    infoWindowRenderer.properties = { popUpInfo: configurePopUpInfo(resultAttributes)};
                    graphic.infoWindowRenderer = infoWindowRenderer;
                }
                resultFeatureLayer.outFields = queryLayer.outFields;
                resultFeatureLayer.visible = true;
                resultFeatureLayer.featureCollection = new FeatureCollection(featureSet, layerDetails);
                
                switch (featureSet.geometryType)
                {
                    case Geometry.MAPPOINT:
                    {
                        resultFeatureLayer.renderer = new SimpleRenderer(resultMarkerSymbol);
                        break;
                    }
                    case Geometry.POLYLINE:
                    {
                        resultFeatureLayer.renderer = new SimpleRenderer(resultLineSymbol);
                        break;
                    }
                    case Geometry.POLYGON:
                    {
                        resultFeatureLayer.renderer = new SimpleRenderer(resultFillSymbol);
                        break;
                    }
                }
                
                return result;
            }
            
            private function setDefaultGraphicSymbol(graphic:Graphic):void
            {
                switch (graphic.geometry.type)
                {
                    case Geometry.MAPPOINT:
                    {
                        graphic.symbol = resultMarkerSymbol;
                        break;
                    }
                    case Geometry.POLYLINE:
                    {
                        graphic.symbol = resultLineSymbol;
                        break;
                    }
                    case Geometry.POLYGON:
                    {
                        graphic.symbol = resultFillSymbol;
                        break;
                    }
                }
            }

0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

  Whether the layer is 100% transparent or not even added as an operational layer to the map the search should still add results to the map... Try adding all the default symbols:

<symbols>
        <simplefillsymbol color="0x00ffff" alpha="0.5">
            <outline color="0xff0000" alpha="0.8" width="2" />
        </simplefillsymbol>
        <picturemarkersymbol url="assets/images/i_search.png" height="30" width="30" xoffset="0" yoffset="0" />
        <simplelinesymbol color="0xff0000" alpha="0.8" width="2" />
    </symbols>
0 Kudos
DanielJohns
Occasional Contributor
Robert,

I tried your suggestion and it did not work, it's ignoring the xml defined parameters. I went back and published a new service with the same layers, but duplicated it and created different variations: original - with 100% transparency set, another without transparency set and one normal with only a scale reference set. I pushed it and used it as an operational layer and only the ones without transparency worked.

I'll continue to look around in the code to see what could be different from the 2.5 version.

Thank you,
Daniel



Daniel,

  Whether the layer is 100% transparent or not even added as an operational layer to the map the search should still add results to the map... Try adding all the default symbols:

<symbols>
        <simplefillsymbol color="0x00ffff" alpha="0.5">
            <outline color="0xff0000" alpha="0.8" width="2" />
        </simplefillsymbol>
        <picturemarkersymbol url="assets/images/i_search.png" height="30" width="30" xoffset="0" yoffset="0" />
        <simplelinesymbol color="0xff0000" alpha="0.8" width="2" />
    </symbols>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   I have no problem at all getting a polyline layer to show results upon searching that layer. See attached image.

[ATTACH=CONFIG]26831[/ATTACH]
0 Kudos
DanielJohns
Occasional Contributor
Well.. that's odd. I just downloaded this package from GitHub yesterday (master). I'll try downloading it again.
0 Kudos
DanielJohns
Occasional Contributor
Daniel,

   I have no problem at all getting a polyline layer to show results upon searching that layer. See attached image.

[ATTACH=CONFIG]26831[/ATTACH]


I found a solution /workaround for the issue.

Instead of setting the transparency to 100%, just change the color to 'no color.'

I did go back and re-download both the master and develop branches and neither worked, which leads me to believe it�??s not a Flex issue. Regardless it�??s fixed so I can proceed.

Thank you.
0 Kudos
Juan_CarlosFranco
Esri Contributor
Thank you for reporting this. I've created issue #188 on GitHub to address this bug.
0 Kudos