how to remove items from basemapGallery widget - 4.3

844
1
04-13-2017 10:21 AM
douglascurl
New Contributor III

I'm trying to develop with the 4.3 API, and I cannot figure out how to remove basemapGallery maps from the 4.3 basemapGallery widget - for the default ESRI basemaps. In 3.x you can just use the basemapGallery.remove(i) method to remove items. But I don't see how to do that with 4.3. I'm sure it has something to do with the source property, but I'm not really certain how to use that property.

0 Kudos
1 Reply
thejuskambi
Regular Contributor

In 4.x you would need to use the source property of the BasemapGallery to achieve this. Its a starting point where you can look into.

BasemapGallery | API Reference | ArcGIS API for JavaScript 4.3 

There are two types of source you can provide to the BasemapGallery. The LocalBasemapsSource is used to show custom basemaps only. In case of ESRI Basemaps, the widget, get the list from portal (PortalBasemapsSource). You might have to use that object to manipulate it. There are 2 ways to do it. You can either use the basemaps Collection itself or use the filterFunction to filter the unwanted basemaps.