Web AppBuilder for ArcGIS (Developer Edition)

SymbolChooser class

The SymbolChooser class allows you to configure the marker symbol, line symbol, fill symbol, and text symbol.

AMD Module Require

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

Constructor

new SymbolChooser(params, srcNodeRef)

Creates a new SymbolChooser dijit.

Parameters:

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

<DOMNode | String> srcNodeRef—Required. HTML element where SymbolChooser is rendered.

params properties:

<String> type—Optional. This property indicates which symbol the dijit shows. The available values are marker, line, fill, and text.

Note:

Either the type property or the symbol property is required.

<Symbol> symbol—Optional. The symbol to show.

Note:

The symbol property only supports the following types: SimpleMarkerSymbol, PictureMarkerSymbol, SimpleLineSymbol, CartographicLineSymbol, SimpleFillSymbol, and TextSymbol. Either the typeproperty or the symbol property is required.

Example:

require(['jimu/dijit/SymbolChooser'], function(SymbolChooser){
			    		var symbolChooser = new SymbolChooser({
			    			type: "marker"
			    		}, srcNodeRef);
			    		...
			    	});

			    	require(['jimu/dijit/SymbolChooser','esri/symbols/SimpleMarkerSymbol'], function(SymbolChooser, SimpleMarkerSymbol){
			    		var symbol = new SimpleMarkerSymbol();
						var symbolChooser = new SymbolChooser({
			    			symbol: symbol
			    		}, srcNodeRef);
			    		...
			    	});

Methods

showByType(type)

Determines which symbol shows.

Parameters:

<String> type—Required. The available values are marker, line, fill, and text.

showBySymbol(symbol)

Shows the specified symbol.

Parameters:

<Symbol> symbol—Required. The symbol to show. It only supports the following types: SimpleMarkerSymbol, PictureMarkerSymbol, SimpleLineSymbol, CartographicLineSymbol, SimpleFillSymbol, and TextSymbol.

getSymbol()

Gets the symbol configured by SymbolChooser.

Return type: Symbol.

Events

change

Fires when the symbol changes.

Example:

require(['dojo/on','jimu/dijit/SymbolChooser'], function(on, SymbolChooser){
		    			var symbolChooser = new SymbolChooser(...);
		    			...
		    			on(symbolChooser,'change', function(newSymbol){
		    				console.log(newSymbol);
		    			});
		    		})