Select to view content in your preferred language

Custom basemap not loading after first click

349
1
Jump to solution
01-17-2023 08:01 AM
ADITYAKUMAR1
Occasional Contributor III

Hi,

   I have added a custom basemap to the basemap gallery. I am using Arcgis JavaScript 4

this.basemapGallery = new BasemapGallery({
view: this.map.mapView,
container: this.basemapGalleryDiv,
source: {
query: {
title: "Custom Basemap",
},
updateBasemapsCallback: (items) => {
if (this.customBasemap) {
items.push(this.customBasemap);
}

console.log(items);

return items;
// return items;

}
}
});

 

I can see the basemap gallery with custom basemap.but it works only on first click. When I go to any other basemap and comes back to the custom basemap, the basemap does not load. Any idea why its not working as expected?

 

Thanks

Aditya Kumar

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

HI there, 

I just tested your code snippet with JS API version 4.25 and was not able to reproduce the behavior you described. Here is the codepen: https://codepen.io/U_B_U/pen/OJOVKyP?editors=1000

 

 

View solution in original post

1 Reply
UndralBatsukh
Esri Regular Contributor

HI there, 

I just tested your code snippet with JS API version 4.25 and was not able to reproduce the behavior you described. Here is the codepen: https://codepen.io/U_B_U/pen/OJOVKyP?editors=1000