Alexis,
It can be done with some coding changes and manually adding the searchExtent to the search widgets config_Search.json
Here is the config_Search.json (lines 10-18):
{
"sources": [
{
"url": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
"name": "Esri World Geocoder",
"singleLineFieldName": "SingleLine",
"placeholder": "Esri World Geocoder",
"maxResults": 6,
"type": "locator",
"searchExtent": {
"xmin": -9589858.361942431,
"ymin": 3964964.109405532,
"xmax": -9522593.777051566,
"ymax": 4031693.635098401,
"spatialReference": {
"wkid": 102100
}
}
},
Then in the [install Dir]\server\apps\[app #]\widgets\Search\Widget.js (Lines 4-16):
_convertConfig: function(config) {
var searchSouces = array.map(config.sources, lang.hitch(this, function(source) {
if (source && source.url && source.type === 'locator') {
var locSource = {
locator: new Locator(source.url || ""),
outFields: ["*"],
singleLineFieldName: source.singleLineFieldName || "",
name: source.name || "",
placeholder: source.placeholder || "",
countryCode: source.countryCode || "",
maxResults: source.maxResults || 6
};
if(source.searchExtent){
locSource.searchExtent = new Extent(source.searchExtent);
}
return locSource;
} else if (source && source.url && source.type === 'query') {
And you have to add the Extent require to the requires list in the Widget.js (lines 2, 7)
'dojo/i18n!esri/nls/jsapi',
'esri/geometry/Extent',
'dojo/NodeList-dom'
],
function(declare, lang, array, html, when, on, query, keys,
BaseWidget, LayerInfos, jimuUtils, Search, Locator,
FeatureLayer, InfoTemplate, esriLang, utils, esriBundle, Extent) {