I have added a couple search sources to the Search widget in WAB. The placeholder text for these shows as I have set them, but I want to replace the placeholder text for All of "Find address or place" to better reflect the searches I have set up. I did find a thread on the API for JavaScript, but nothing on how to do it in WAB.
Thanks,
Michelle
Solved! Go to Solution.
Michelle,
Open the [install dir]\server\apps\[app#]\widgets\Search\Widget.js and find the startup function and add line 29 below (Don't forget to add the comma on line 28):
startup: function() {
this.inherited(arguments);
if (!(this.config && this.config.sources)) {
this.config.sources = [];
}
LayerInfos.getInstance(this.map, this.map.itemInfo)
.then(lang.hitch(this, function(layerInfosObj) {
this.layerInfosObj = layerInfosObj;
utils.setMap(this.map);
utils.setLayerInfosObj(this.layerInfosObj);
utils.setAppConfig(this.appConfig);
when(utils.getConfigInfo(this.config)).then(lang.hitch(this, function(config) {
if (!this.domNode) {
return;
}
var searchSouces = this._convertConfig(config);
this.searchDijit = new Search({
activeSourceIndex: searchSouces.length === 1 ? 0 : 'all',
autoSelect: false,
enableButtonMode: false,
enableLabel: false,
enableInfoWindow: true,
showInfoWindowOnSelect: true,
map: this.map,
sources: searchSouces,
theme: 'arcgisSearch',
allPlaceholder: 'My Placeholder'
});
html.place(this.searchDijit.domNode, this.searchNode);
Michelle,
Open the [install dir]\server\apps\[app#]\widgets\Search\Widget.js and find the startup function and add line 29 below (Don't forget to add the comma on line 28):
startup: function() {
this.inherited(arguments);
if (!(this.config && this.config.sources)) {
this.config.sources = [];
}
LayerInfos.getInstance(this.map, this.map.itemInfo)
.then(lang.hitch(this, function(layerInfosObj) {
this.layerInfosObj = layerInfosObj;
utils.setMap(this.map);
utils.setLayerInfosObj(this.layerInfosObj);
utils.setAppConfig(this.appConfig);
when(utils.getConfigInfo(this.config)).then(lang.hitch(this, function(config) {
if (!this.domNode) {
return;
}
var searchSouces = this._convertConfig(config);
this.searchDijit = new Search({
activeSourceIndex: searchSouces.length === 1 ? 0 : 'all',
autoSelect: false,
enableButtonMode: false,
enableLabel: false,
enableInfoWindow: true,
showInfoWindowOnSelect: true,
map: this.map,
sources: searchSouces,
theme: 'arcgisSearch',
allPlaceholder: 'My Placeholder'
});
html.place(this.searchDijit.domNode, this.searchNode);
Exactly what I needed, thank you so much! I often find your replies to others helpful as well, Esri should put you on the payroll!
Robert,
It works fine by use `allPlaceholder`!
Could you tell me where you find this property, I never found this property in doc of api.
Thanks.
ZeZheng Li,
Matt Driscoll, mentioned in this thread Re: Discover the Search widget that it is currently undocumented but they were going to fix that.
This is perfect! works like a charm even still on 2.22
Thank you!