I'm hoping to find some existing code which emulates the "Select by Attributes" dialog in ArcMap, within the ArcGIS Server JavaScript API.

Writing a hard-coded QueryTask is easy - I'm looking for some code which will automatically handle any layer on the map, forming a Query on-the-fly using any attributes, ideally returning the results into a datagrid.

Clever people have written Table of Contents and Identify widgets which handle any layers in the map. Has anyone written something similar for "select by attributes"?

  • Did you ever find a solution to this?
    – user5070
    Dec 7, 2011 at 17:17
  • Nothing yet, sorry Jun 4, 2012 at 14:34
  • Do you try the find task ? help.arcgis.com/en/webapi/javascript/arcgis/samples/find_map/…
    – user3120
    Nov 7, 2012 at 20:27
  • 2
    I wasn't aware that there is some specific plugin architecture for the Javascript API. Were you looking for a dojo widget which works and looks like the Select By Attribute window in ArcMap? Jan 2, 2013 at 10:39
  • 1
    @DevdattaTengshe I was hoping for something similar to this TOC sample which is easy to integrate Jan 6, 2013 at 23:43

3 Answers 3


A couple of years later, I was looking for exactly the same thing as the OP. This question shows up in the top results of a search engine, so I decided to leave this update here as a reference.

In the Summer of 2015, Esri has released a Select by Attributes Widget in their GitHub repository.

This widget attempts to recreate ArcMap's select by attributes tool as accurately as possible within a JavaScript application. This widget only works with feature layers and these must be passed to the widget's constructor as an array.

Live Sample


If you are using ArcServer 10.1 you could create a Geoprocessing service which references either a model or script that you built to do this.

The link above gives step by step instructions on how to create the model, then create the services and finally consume it in your app.

Alternatively, there is this sample that uses a query to select records, you could modify that to allow for multiple services.


It's clear that there is an appetite for a plugin like this.

As everyone has noted, there's nothing particularly difficult about running a single, simple query. Where it gets complicated is building an interface to help the user to write a valid query for the current layer(s) on the map, running the query, then doing something with the result(s).

I ended up writing a bespoke solution which does all of the above, which took a good week or so of development.

My solution is embedded reasonably tightly into the rest of my mapping framework, so unfortunately it's not easy to "export" this into a stand-alone "select by attributes plugin" - possibly why nothing like this exists so far?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.