Query or Filter Widget?? WAB

617
4
Jump to solution
06-06-2018 01:10 PM
AlexP_
by
Regular Contributor

Hello,

Please see screenshot. I have a question. On query widget, is there any way to remove 'Statistics'? I am trying to set up query or filter widget on WAB. It is a bit confusing. My goal is to have all layers default invisibility until use filter or query widget apply results only to display. How can I procedure this? Please advise!! Thank you.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Alex,

   To remove the Statistics... option from the widget action menu you have to alter some widget code. In the SingleQueryResult.js find the _onBtnMenuClicked function and make this change (line 24).

      _onBtnMenuClicked: function(evt) {
        var position = html.position(evt.target || evt.srcElement);
        var featureSet = this._getFeatureSet();
        var currentAttrs = this.getCurrentAttrs();
        var layer = currentAttrs.query.resultLayer;
        this.featureActionManager.getSupportedActions(featureSet, layer).then(lang.hitch(this, function(actions) {
          array.forEach(actions, lang.hitch(this, function(action) {
            action.data = featureSet;
          }));

          if (!currentAttrs.config.enableExport) {
            var exportActionNames = [
              'ExportToCSV',
              'ExportToFeatureCollection',
              'ExportToGeoJSON',
              'SaveToMyContent'
            ];
            actions = array.filter(actions, lang.hitch(this, function(action) {
              return exportActionNames.indexOf(action.name) < 0;
            }));
          }

          actions = array.filter(actions, lang.hitch(this, function(action) {
            return action.name !== 'CreateLayer' && action.name !== 'ShowStatistics';
          }));
....

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Alex,

   To remove the Statistics... option from the widget action menu you have to alter some widget code. In the SingleQueryResult.js find the _onBtnMenuClicked function and make this change (line 24).

      _onBtnMenuClicked: function(evt) {
        var position = html.position(evt.target || evt.srcElement);
        var featureSet = this._getFeatureSet();
        var currentAttrs = this.getCurrentAttrs();
        var layer = currentAttrs.query.resultLayer;
        this.featureActionManager.getSupportedActions(featureSet, layer).then(lang.hitch(this, function(actions) {
          array.forEach(actions, lang.hitch(this, function(action) {
            action.data = featureSet;
          }));

          if (!currentAttrs.config.enableExport) {
            var exportActionNames = [
              'ExportToCSV',
              'ExportToFeatureCollection',
              'ExportToGeoJSON',
              'SaveToMyContent'
            ];
            actions = array.filter(actions, lang.hitch(this, function(action) {
              return exportActionNames.indexOf(action.name) < 0;
            }));
          }

          actions = array.filter(actions, lang.hitch(this, function(action) {
            return action.name !== 'CreateLayer' && action.name !== 'ShowStatistics';
          }));
....
AlexP_
by
Regular Contributor

Hello Robert,

Thank you for your reply. I am using WAB from ArcGIS Online template. Is this only for WAB developer edition or ArcGIS Online Assistant? Please confirm. 

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Alex,

   If you want to modify something that is not configurable like this in a widget them you will have to use WAB Dev.

AndrewValenski__IT_
Occasional Contributor III

Alex P.‌ Be sure to mark Robert Scheitlin, GISP‌'s answers as correct!

0 Kudos