Skip To Content
ArcGIS Developer

LayerChooserFromMap class

The LayerChooserFromMap class filters layers from the map with a specified filter function and constructs a UI tree to display layers.

AMD Module Require

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


new LayerChooserFromMap(params, srcNodeRef)

Creates a new LayerChooserFromMap dijit.


<Object> params—Required. Parameters for the LayerChooserFromMap dijit.

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

params properties:

<Object> createMapResponse—Required. The callback response of the esri.arcgis.utils#createmap method. You can get this object using the webMapResponse property of the map.

<Boolean> multiple—Optional. The default is false. By default, you can only select one layer. If set to true, you can select multiple layers.


require(['jimu/dijit/LayerChooserFromMap'], function(LayerChooserFromMap){
          var layerChooser = new LayerChooserFromMap({
            createMapResponse: map.webMapResponse,
            multiple: false
          }, srcNodeRef);



This is a callback function. The LayerChooserFromMap dijit calls this method automatically when filtering layers. Only layers that pass the filter show on the dijit. The default filter method lets all the layers pass it and shows all of them. You can override this method to filter layers as needed.

Return type: Deferred object that returns a Boolean value. If true, layerInfo passes the filter method.


<LayerInfo> layerInfo—Required. The layerInfo parameter contains the layer's information.


Gets information for selected layers.

Return type: Object array. Each element is in the form {name, layerInfo}.