Pass a value to http redirect using Enhanced Search Widget in WAB

609
2
Jump to solution
11-28-2017 08:47 AM
MartinOwens1
Occasional Contributor II

I have an embedded WAB Application using the enhanced search widget from #robert scheitlin‌ in aspx and would like to perform an http redirect after a search or mouse click within the map using a value in the results pane to reload the aspx page. Any information would be appreciated. Thanks!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Martin,

   In the eSearch widget.js file find the _drawResults function:

      _drawResults: function (layerIndex, results, currentLayer, closeOnComplete) {
        var layerConfig = this.config.layers[layerIndex];
        if (this.graphicsLayerBuffer instanceof FeatureLayer) {
          this._addOperationalLayer(this.graphicsLayerBuffer);
        }
        if (currentLayer instanceof FeatureLayer) {
          this._addOperationalLayer(currentLayer);
        }

        var type, centerpoint;
        for (var i = 0, len = this.currentFeatures.length; i < len; i++) {
          var feature = this.currentFeatures[i];
          //Do your stuff here as this would be the results from a search
          var parcelId = feature.attributes["yourfieldname"];
          //Now use parcelId in your redirect.
          //I am not sure about the aspx part maybe something like
          window.parent.location = "new url";

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Martin,

   In the eSearch widget.js file find the _drawResults function:

      _drawResults: function (layerIndex, results, currentLayer, closeOnComplete) {
        var layerConfig = this.config.layers[layerIndex];
        if (this.graphicsLayerBuffer instanceof FeatureLayer) {
          this._addOperationalLayer(this.graphicsLayerBuffer);
        }
        if (currentLayer instanceof FeatureLayer) {
          this._addOperationalLayer(currentLayer);
        }

        var type, centerpoint;
        for (var i = 0, len = this.currentFeatures.length; i < len; i++) {
          var feature = this.currentFeatures[i];
          //Do your stuff here as this would be the results from a search
          var parcelId = feature.attributes["yourfieldname"];
          //Now use parcelId in your redirect.
          //I am not sure about the aspx part maybe something like
          window.parent.location = "new url";
MartinOwens1
Occasional Contributor II

That did it thanks Robert!!!

0 Kudos