Skip To Content
ArcGIS Developer

Filter class

The Filter class constructs complicated SQL query statements by UI operations to filter features from the feature layer or stream layer. It supports String, Number, and Date fields.

AMD Module Require

require(["jimu/dijit/Filter"], function(Filter) { /* code goes here */ });


new Filter(params, srcNodeRef)

Creates a new Filter dijit.


<Object> params—Optional. Parameters for the Filter dijit.

<DOMNode | String> srcNodeRef—Optional. HTML element where Filter is rendered.

params properties:

<String> noFilterTip—Optional. Shows the ToolTip when no filters are added.


require(['jimu/dijit/Filter'], function(Filter){
        var url = "";
        var filter = new Filter();
        var options = {
           url: ***,
           partsObj: ***,



Removes all filters and resets the Filter dijit to the original status.


Gets the filter JSON information using the UI settings.

Return type: Object. The returned value contains the SQL query statement.


var partsObj = filter.toJson();
 if(partsObj && partsObj.expr){
    console.log("SQL query statement:", partsObj.expr);


Builds the UI for the Filter dijit by JSON (which includes the filter information) or parses the SQL query statement and builds the UI for the Filter dijit.

Return type: Deferred object. When it resolves, the build process is done.


<String> url—Required. The REST service URL.

<String> partsObj—Required. The partsObj format is the same as the returned value of the toJson method. Practically, you should not construct this object by yourself, but call the toJson method to get the partsObj parameter and save it in memory or a file. In this way, you can pass parsObj into the method and build the UI for the Filter dijit so that a user can see the same Filter UI again.

<String> expr—Optional. The SQL query statement that the Filter dijit will parse. If you don't pass it, the default value is '1=1', which means no filters. If you pass an invalid SQL query statement, it may throw an exception. To make sure you pass a valid SQL query statement, get the SQL expression from the toJson method of the Filter dijit.


The partsObj or expr parameter is required; partsObj has priority.

<Object> layerDefinition—Optional. The structure is the same as the information returned by REST for a layer in a feature service or map service.

<String> featureLayerId—Optional. The ID of the current feature layer.