<?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 -->
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; } } }
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; } } }
<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>
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>
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]
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.