Tweaks to Query Widget

1007
4
05-08-2017 02:40 PM
MikeRiccio
New Contributor II

Hello, I'm trying to tweak the default query widget in the Dev version of the webappbuilder. I'm trying to accomplish two tweaks:

1) Disable the export to GeoJSON and Feature Collection options but I'd still like the ability to export to CSV. 

2) Make searching within a spatial extent an optional part of the query. Ironically, on the portal version of WebApp Builder, the query widget allows you to leave the spatial extent unused and still allows the query to be executed. However on the Dev version, the query cannot be executed unless a shape is drawn on the map. 

I'm guessing these are just config options somewhere in the query widget js files, I'm just not sure where to look / haven't realized I've been staring at them all along. Any help would be appreciated.

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Mike,

  1. There is no configuration option to remove these but you can do it in the code. In the Query widgets SingleQueryResult.js
    actions = array.filter(actions, lang.hitch(this, function(action) {
      return action.name !== 'CreateLayer' && action.name !== 'ExportToGeoJSON' && action.name !== 'ExportToFeatureCollection';
    }));
  2. It sounds like you have "Only return features that intersect with the shape drawn on the map" checked.
MikeRiccio
New Contributor II

Hi Robert, thanks for the reply. 

1) I was able to find and edit that bit of code in SingleQueryResult.js, but I found that I also needed to remove the "Export to GeoJSON" and "Export to Feature Collection" options from the jimu.js\featureActions\main.js file as well in the definition and return.

2) Yes, I do have it checked. I would like the user to have the optional ability to custom define an area to search along with the drop-down options of the query. As I mentioned in my first post, in the version of web app builder that ships with the latest version of Portal for ArcGIS, I made an app using the same webmap and services and checked off the "Only return features that intersect with the shape drawn on the map" filter option. This Portal version was still able to execute the query if a shape was not drawn and only the drop down options were filled. I would like to replicate that flexibility in the Dev Version. Maybe it was a bug in the Portal version that got corrected in the Dev version? 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mike,

1. Strange I did not have to do anything other then the changes I posted earlier.

2. I would contact tech support. Right now the AGOL version and WABdev version are suppose to be the same at v2.4.

0 Kudos
MikeRiccio
New Contributor II

Thanks Robert, I will reach out to them. I think the version that ships with portal is a version behind the AGOL version. 

0 Kudos