private function init():void { if(configXML) { searchTip = configXML.textsearchtip; advancedAutoComplete.toolTip = searchTip; } _xlcDP = new XMLListCollection(dp.Building); advancedAutoComplete.setStyle("textRollOverColor",0x000000); advancedAutoComplete.setStyle("textSelectedColor",0x000000); }
Naty, I ran into this before and was not able to change the background color in the autocomplete component. So sorry my best advice is to change your text color for the whole Flex Viewer.
Naty, This is what I would change in the code:<hc:AdvancedAutoComplete id="advancedAutoComplete" x="8" y="30" width="250" dataProvider="{_xlcDP}" labelField="@name" matchType="anyPart" showRemoveIcon="true" selectedItemStyleName="none" color="#000000" change="execSearch()" itemClick="{advancedAutoComplete.showBrowser()}" actionsMenuDataProvider="{autoCompleteMenuData}" browserFields="{[{label:'Building Name', field:'@name'}]}"/>
<hc:AdvancedAutoComplete id="advancedAutoComplete" x="8" y="30" width="250" dataProvider="{_xlcDP}" labelField="@name" matchType="anyPart" showRemoveIcon="true" selectedItemStyleName="none" color="#000000" change="execSearch()" itemClick="{advancedAutoComplete.showBrowser()}" actionsMenuDataProvider="{autoCompleteMenuData}" browserFields="{[{label:'Building Name', field:'@name'}]}"/>
Naty, Sure the url portion of the search would not use the minisearch at all just the built in capability of the eSearch to query based on the URL. The URL would look like thisindex.html?search=1&slayer=0&exprnum=0you need to look at the documentation that comes with the eSearch to see what each of these are doing.Here is the code changes you need to use in the MiniSearch to use the eSearch instead: private function execSearch():void { if(advancedAutoComplete.selectedItem){ try{ var aaa:String=advancedAutoComplete.selectedItem.@code; var msArr:ArrayCollection = new ArrayCollection(); msArr.addItem(aaa); addSharedData("MiniSearch_Search", msArr); var id:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Enhanced Search"); var bWidget:IBaseWidget = ViewerContainer.getInstance().widgetManager.getWidget(id, true) as IBaseWidget; if (bWidget){ var vSW:* = bWidget; vSW.queryFromURL(aaa,0,0); } }catch (error:Error){ AppEvent.showError( error.message ); } } }And add the same commented areas I had in the original SearchWidget.mxml
private function execSearch():void { if(advancedAutoComplete.selectedItem){ try{ var aaa:String=advancedAutoComplete.selectedItem.@code; var msArr:ArrayCollection = new ArrayCollection(); msArr.addItem(aaa); addSharedData("MiniSearch_Search", msArr); var id:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("Enhanced Search"); var bWidget:IBaseWidget = ViewerContainer.getInstance().widgetManager.getWidget(id, true) as IBaseWidget; if (bWidget){ var vSW:* = bWidget; vSW.queryFromURL(aaa,0,0); } }catch (error:Error){ AppEvent.showError( error.message ); } } }
Naty, That has never been an option in the search widget only the eSearch widget.
Naty, In your querybmpid function add the red lines below: public function querybmpid(sParam:String):void { //hide infowindow if any hideInfoWindow(); var i:int = 0; queryLayer = configSearchText.layer; showMessage(queryLayer.name, false); if (queryLayer && !queryLayer.loaded) { queryLayer.addEventListener(LayerEvent.LOAD, queryLayer_loadHandler); function queryLayer_loadHandler(event:LayerEvent):void { querybmpid(sParam) } return; } queryExpr = configSearchText.expr; queryFields = configSearchText.fields; queryTitleField = configSearchText.titlefield; queryLinkField = configSearchText.linkfield; if (queryLayer && sParam) { var query:Query = new Query(); var expr:String = queryExpr.replace(/\[value\]/g, sParam); query.where = expr; query.outSpatialReference = map.spatialReference; queryLayer.queryFeatures(query, new AsyncResponder(onResult, onFault, queryFields)); showMessage(loadingLabel, true); showStateResults(); function onResult(featureSet:FeatureSet, token:XMLList = null):void { try { searchResultAC = createSearchResults(featureSet, token); // share data addSharedData(widgetTitle, searchResultAC); if (featureSet.features.length < 1) { showMessage(noResultLabel, false); } else { showMessage(selectionLabel + " " + featureSet.features.length, false); var searchResult:SearchResult = searchResultAC[0] as SearchResult; showHighlight([searchResult]); } } catch (error:Error) { showMessage(error.message, false); } } function onFault(info:Object, token:Object = null):void { showMessage(info.toString(), false); } } }
public function querybmpid(sParam:String):void { //hide infowindow if any hideInfoWindow(); var i:int = 0; queryLayer = configSearchText.layer; showMessage(queryLayer.name, false); if (queryLayer && !queryLayer.loaded) { queryLayer.addEventListener(LayerEvent.LOAD, queryLayer_loadHandler); function queryLayer_loadHandler(event:LayerEvent):void { querybmpid(sParam) } return; } queryExpr = configSearchText.expr; queryFields = configSearchText.fields; queryTitleField = configSearchText.titlefield; queryLinkField = configSearchText.linkfield; if (queryLayer && sParam) { var query:Query = new Query(); var expr:String = queryExpr.replace(/\[value\]/g, sParam); query.where = expr; query.outSpatialReference = map.spatialReference; queryLayer.queryFeatures(query, new AsyncResponder(onResult, onFault, queryFields)); showMessage(loadingLabel, true); showStateResults(); function onResult(featureSet:FeatureSet, token:XMLList = null):void { try { searchResultAC = createSearchResults(featureSet, token); // share data addSharedData(widgetTitle, searchResultAC); if (featureSet.features.length < 1) { showMessage(noResultLabel, false); } else { showMessage(selectionLabel + " " + featureSet.features.length, false); var searchResult:SearchResult = searchResultAC[0] as SearchResult; showHighlight([searchResult]); } } catch (error:Error) { showMessage(error.message, false); } } function onFault(info:Object, token:Object = null):void { showMessage(info.toString(), false); } } }
Robert u are great!!When I will have time (I hope soon) I compare the old SearchWidget with the new...so I can see the difference and maybe I will better understand what u did and how it works..thank u sooooo much.Naty
Naty, OK, it's fixed.
Naty, Here is your MiniSearch updated to a Flex Viewer 2.4 actual widget.Also I forgot to mention in the readme.txt that the widget has to go in the UI section at the top of the config.xml like the NavigationWidget.
Naty, I have to ask again if this is the right code it is hard to believe that you are using something that looks like this:[ATTACH=CONFIG]8383[/ATTACH]
Naty, Are you sure this is the right code?... Most of the code that does anything is commented out?...
Naty, If I remember right you mad a lot of changes after I posted the miniSearch so it might be better if you post what you have in 1.3 and I will see about upgrading it. Don't forget to send your actual searchWidget mods too.
WowwwwwwThank u so much Robert!!!Naty
Thanks I will keep my eyes open for it.
Naty, Do you have a complete mini search as you are using it? I would like to see what you have done and maybe implement some of it on my site. It sounds like you have it set up to handle a broad amount of data. Please let me know. Thanks, Alex
Naty, I have seen this before and the fix is simple. //Just comment out this line or delete it. var bWidg:BaseWidget = bWidget.getInstance(); // and change this line var vSW:SearchWidget = bWidg as SearchWidget; to var vSW:SearchWidget = bWidget as SearchWidget;
//Just comment out this line or delete it. var bWidg:BaseWidget = bWidget.getInstance(); // and change this line var vSW:SearchWidget = bWidg as SearchWidget; to var vSW:SearchWidget = bWidget as SearchWidget;
Robert I downloaded the debugger and I m running itbut it stops here:[SWF] /Buildings/com/esri/solutions/flexviewer/assets/flash/red_glow.swf - 1,082 bytes after decompression[SWF] /Buildings/com/esri/solutions/flexviewer/assets/flash/loader.swf - 941 bytes after decompressionTypeError: Error #1009: Cannot access a property or method of a null object reference. at Function/com.esri.solutions.flexviewer:MapManager/refreshLayer/com.esri.solutions.flexviewer:timerHandler() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()
var id:Number = SiteContainer.getInstance().getWidgetId("Search"); var bWidget:IBaseWidget = SiteContainer.getInstance().widgetManager.getWidget(id) as IBaseWidget; var aaa:String; aaa=ti.text; if (bWidget){ var bWidg:BaseWidget = bWidget.getInstance(); var vSW:SearchWidget = bWidg as SearchWidget; vSW.queryBuilding(aaa);
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.