ItemSelector class

The ItemSelector class allows you to search items of specified types in ArcGIS Enterprise and ArcGIS Online.

AMD Module Require

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

Constructor

new ItemSelector (params, srcNodeRef)

Creates a new ItemSelector dijit.

Parameters:

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

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

params properties:

<String> portalUrl—Required. The portal URL of your portal, such as http://orgname.maps.arcgis.com or http://myportal.company.com/instancename.

<String>[] itemTypes—Required. ItemSelector supports multiple item types to show items. Only items with specified types will show, such as ['Web Map'], ['Feature Service','Map Service'], and so on.

<String>[] typeKeywords—Optional. ItemSelector also supports search by multiple type key words. Only items with specified typeKeywords will show, such as ['Web AppBuilder'], ['Web AppBuilder','Web Map'] and so on.

Example:

require(['jimu/dijit/ItemSelector'], function(ItemSelector){
        var itemSelector = new ItemSelector({
          portalUrl: "http://orgname.maps.arcgis.com",
          itemTypes: ['Feature Service','Map Service']
        }, srcNodeRef);
        ...
      });

Methods

getSelectedItem()

Gets the selected item information.

Return type: Object including item information.

Events

item-selected

Fires when you select an item.

Example:

require(['jimu/dijit/ItemSelector', 'dojo/on'], function(ItemSelector, on){
        var itemSelector = new ItemSelector(...);
        ...
        on(itemSelector, 'item-selected', function(itemInfo){
          console.log(itemInfo);
        });
      });

none-item-selected

Fires when you clear all items.

Example:

require(['jimu/dijit/ItemSelector', 'dojo/on'], function(ItemSelector, on){
        var itemSelector = new ItemSelector(...);
        ...
        on(itemSelector, 'none-item-selected', function(){
          console.log("None item is selected.");
        });
      });