how can I modify the Search Widget to stop zooming after a search and to pan if the searched item is outside the current extent?
I did the same in Flex...but with Web AppBuilder I don't understand where I have to modify...
Thanks,
Naty
Naty,
Sure it will require some code changes though:
In the [install dir]\server\apps\[app#]\widgets\Search\Widgets.js, find the _convertConfig function and add line 10 and the comma on 9:
def.resolve({ locator: new Locator(source.url || ""), outFields: ["*"], singleLineFieldName: source.singleLineFieldName || "", name: jimuUtils.stripHTML(source.name || ""), placeholder: jimuUtils.stripHTML(source.placeholder || ""), countryCode: source.countryCode || "", maxResults: source.maxResults || 6, useMapExtent: !!source.searchInCurrentMapExtent, autoNavigate: false });
If you want to do the same for feature layers as well then make these changes as well Line 12 and comma on 11:
var convertedSource = { featureLayer: flayer, outFields: ["*"], searchFields: fNames, displayField: source.displayField || "", exactMatch: !!source.exactMatch, name: jimuUtils.stripHTML(source.name || ""), placeholder: jimuUtils.stripHTML(source.placeholder || ""), maxResults: source.maxResults || 6, infoTemplate: template, useMapExtent: !!source.searchInCurrentMapExtent, autoNavigate: false };
Then in the _onSelectResult function add these line to the end of that function:
if(result.feature.geometry.type === 'point'){ this.map.centerAt(result.feature.geometry); }else{ this.map.centerAt(result.feature.geometry.getExtent().getCenter()); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.