Hide ObjectID in WAB Query Result

577
2
Jump to solution
11-14-2016 04:11 PM
LesiMai3
Occasional Contributor

Hi all,

I was wondering if there is a way to keep ObjectID from displaying when users view the query results in the attribute table.

Any pointers will be greatly appreciated!

Lesi

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Lesi,

  In the Query Widget Widget.js make this change to the _showResultLayerInfo (line 17 - 21):

      _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);
          array.map(layerInfo.layerObject.fields, function(fld){
            if(fld.name === layerInfo.layerObject.objectIdField){
              fld.show = false;
            }
          });
          this.publishData({
            'target': 'AttributeTable',
            'layer': layerInfo
          });
        }else{
          this._activeLayerId = null;
          this._hideAllLayers();
        }
      },

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Lesi,

  In the Query Widget Widget.js make this change to the _showResultLayerInfo (line 17 - 21):

      _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);
          array.map(layerInfo.layerObject.fields, function(fld){
            if(fld.name === layerInfo.layerObject.objectIdField){
              fld.show = false;
            }
          });
          this.publishData({
            'target': 'AttributeTable',
            'layer': layerInfo
          });
        }else{
          this._activeLayerId = null;
          this._hideAllLayers();
        }
      },

View solution in original post

LesiMai3
Occasional Contributor

Thank you, Robert!

0 Kudos