Select to view content in your preferred language

Query results automatically shown in attribute table?

1794
7
Jump to solution
09-27-2016 12:32 PM
helenchu
Frequent Contributor

Is there a way to make query results automatically shown in attribute table?  That way it saves user 1 extra click.   Thank you for your help.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Helen,

   Sure that is simple as editing the _showResultLayerInfo function in the Widget.js (Add lines 15 - 20):

      _showResultLayerInfo: function(resultLayerInfo){
        this._hideAllSingleQueryResultDijits();
        var singleQueryResult = resultLayerInfo.singleQueryResult;
        var resutlLayer = null;
        if (singleQueryResult) {
          html.setStyle(singleQueryResult.domNode, 'display', 'block');
          var currentAttrs = singleQueryResult.getCurrentAttrs();
          resutlLayer = lang.getObject("query.resultLayer", false, currentAttrs);
        }

        if (resutlLayer) {
          this._activeLayerId = resutlLayer.id;
          this._hideAllLayers(resutlLayer);
          resutlLayer.show();
          //now show in at widget
          var layerInfo = this.layerInfosObj.getLayerInfoById(resutlLayer.id);
          this.publishData({
            'target': 'AttributeTable',
            'layer': layerInfo
          });
        }else{
          this._activeLayerId = null;
          this._hideAllLayers();
        }
      },

View solution in original post

7 Replies
RobertScheitlin__GISP
MVP Emeritus

Helen,

   Sure that is simple as editing the _showResultLayerInfo function in the Widget.js (Add lines 15 - 20):

      _showResultLayerInfo: function(resultLayerInfo){
        this._hideAllSingleQueryResultDijits();
        var singleQueryResult = resultLayerInfo.singleQueryResult;
        var resutlLayer = null;
        if (singleQueryResult) {
          html.setStyle(singleQueryResult.domNode, 'display', 'block');
          var currentAttrs = singleQueryResult.getCurrentAttrs();
          resutlLayer = lang.getObject("query.resultLayer", false, currentAttrs);
        }

        if (resutlLayer) {
          this._activeLayerId = resutlLayer.id;
          this._hideAllLayers(resutlLayer);
          resutlLayer.show();
          //now show in at widget
          var layerInfo = this.layerInfosObj.getLayerInfoById(resutlLayer.id);
          this.publishData({
            'target': 'AttributeTable',
            'layer': layerInfo
          });
        }else{
          this._activeLayerId = null;
          this._hideAllLayers();
        }
      },
helenchu
Frequent Contributor

Thank you very much Robert.  I'm not a developer so everything seems too complicated to me 😞

I have this issue with query result in attribute table.  Please see attached image.

If I click to select from the red arrow area, seam like that record is removed from the set.  1st time it zooms to the feature fine, but if I go back, I'll get the error "Data not available!"

If I click to select form the blue arrow area, it's fine.  Just that the attribute record is not highlighted.

Do you experience the same thing ? 

Call ESRI support, they said they can't replicate the error.  It's weird because I've tried on different layers, different servers, same thing happen.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Helen,

   I don't see the image.

0 Kudos
helenchu
Frequent Contributor

Sorry!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Helen,

   Yes I am seeing the same. When you select a row in the AT widget the feature is removed from the query results layer.

0 Kudos
helenchu
Frequent Contributor

Then it is definitely a bug.  Wonder why Esri told us they couldn't replicate the error!

Thanks a bunch Robert!

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

Thanks to you  Robert, it works a treat!

what if I want different level of information in the attribute table from those in the Result Panel, which is supposed to be a list with very concise info and people normally display greater details in the attribute table and pop-up window. I found it's quite hard to achieve it by simply configuring the out-of-box Query widget... any suggestions? thanks.

0 Kudos