AnsweredAssumed Answered

Search widget modifications

Question asked by guess on Mar 29, 2018
Latest reply on Mar 30, 2018 by guess

I would like to remove the default symbology of the polygon selection result of the Search widget.  I'm doing this within some custom code utilizing the aspect.around module accessing the _onSearchResults function of the Search widget.js file; however, I'm unable to get this to fully work.  Below is my aspect.around module which is within a function where the widget gets passed in.

 

Any help or thoughts would be appreciated.

 

aspect.around(widget, '_onSearchResults', lang.hitch(this, function(originalMethod) {
return lang.hitch(this, function() {
var features, feature, layer, queryLayer, queryLayerUrl, queryTask, query, pt;
features = [];
feature = null;
if (arguments) {
features = arguments[0].results[0];

array.forEach(features, function (feature){
// Search for Intersection
if (feature.feature.attributes.Loc_name === 'Streets' && feature.feature.attributes.Addr_type === 'StreetInt'){
originalMethod.apply(widget, arguments);
}else{
// Search for Owner, Address, PID, or S-T-R
if (feature.feature.attributes.Loc_name === "Parcels" || feature.feature.attributes.Loc_name === "Owner" || feature.feature.attributes.Loc_name === "AddressPoints" || feature.feature.attributes.Loc_name === "PID") {
queryLayerUrl = this.queryParcelUrl;
layer = this.qlayer;
} else if (feature.feature.attributes.Loc_name === 'STR') {
queryLayerUrl = this.querySectionUrl;
layer = this.qlayer;
}

query = new EsriQuery();
query.outSpatialReference = this.map.spatialReference;
query.returnGeometry = true;
query.outFields = this.queryLayerOutFields;

pt = feature.feature.geometry;
query.geometry = pt;

// parcel selection symbol - only for Search tool
this.parcelSelSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_NULL));


queryTask = new QueryTask(queryLayerUrl);
queryTask.execute(query, lang.hitch(this, function(result) {
this.map.graphics.clear();
var selfeature, graphic, poly, point;
if (result.features.length > 0){
selfeature = result.features[0];
graphic = selfeature;
poly = selfeature.geometry.getExtent();
point = selfeature.geometry.getCentroid();
graphic.setSymbol(this.parcelSelSymbol);
this.map.graphics.add(graphic);
this.map.setExtent(poly.expand(2));
this.map.infoWindow.hide();
this.map.infoWindow.clearFeatures();
this.map.infoWindow.setFeatures([selfeature]);
}
}));
}
}, this);

Outcomes