Select to view content in your preferred language

basemap gallery component bugs !! automatically disabled if you move tag outside of map tag

259
5
Jump to solution
a week ago
hoogw
by
Regular Contributor

 

Here is sample code, 

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=basemap-gallery

 

if you move 

    <arcgis-basemap-gallery position="top-right"></arcgis-basemap-gallery>

outside of 

   </arcgis-map>

tag, 

 

base map gallery will be disabled automatically. 

see my screen. 

hoogw_0-1750462085693.png

 

even in js, I set 

 document.querySelector("arcgis-basemap-gallery").disabled = false 
 
Still not working, still disabled. 

 

 

0 Kudos
4 Solutions

Accepted Solutions
hoogw
by
Regular Contributor

the sample works fine, is because 

 

  <arcgis-basemap-gallery position="top-right"></arcgis-basemap-gallery>

is inside of 

   </arcgis-map>

tag, 

View solution in original post

0 Kudos
ReneRubalcava
Esri Frequent Contributor

When working with the map-components, if a component is not a child of a map or scene component, you can use a "reference-element" attribute to associate them.

View solution in original post

hoogw
by
Regular Contributor

Here is how to use reference element, 

 

https://developers.arcgis.com/javascript/latest/programming-patterns/ 

hp_1134.png

warning:  when you use reference element in html tag, you must use exact word "reference-element"

when you use reference element in javascript, must use exact word "referenceElement"

They are not interchangable, otherwise, will not work.

 

Based on this theory, I correct the online sample as following

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=basemap-gallery 

hp_1135.png

View solution in original post

0 Kudos
ReneRubalcava
Esri Frequent Contributor

"reference-element" is the attribute name, only to be used declaratively.

"referenceElement" is the property name, which be accessed via "element.referenceElement". It would also be used in jsx syntax for various UI libraries.

https://developers.arcgis.com/javascript/latest/programming-patterns/#attributes-and-properties

View solution in original post

5 Replies
hoogw
by
Regular Contributor

the sample works fine, is because 

 

  <arcgis-basemap-gallery position="top-right"></arcgis-basemap-gallery>

is inside of 

   </arcgis-map>

tag, 

0 Kudos
ReneRubalcava
Esri Frequent Contributor

When working with the map-components, if a component is not a child of a map or scene component, you can use a "reference-element" attribute to associate them.

hoogw
by
Regular Contributor

based on your advice, I test it like this, it does not work. Unless I did it not the way you means. Please use this online sample as test, explain what you exactly means, how to use reference element?

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=basemap-gallery 

hoogw_0-1750692399478.png

 

 

 

 

 

0 Kudos
hoogw
by
Regular Contributor

Here is how to use reference element, 

 

https://developers.arcgis.com/javascript/latest/programming-patterns/ 

hp_1134.png

warning:  when you use reference element in html tag, you must use exact word "reference-element"

when you use reference element in javascript, must use exact word "referenceElement"

They are not interchangable, otherwise, will not work.

 

Based on this theory, I correct the online sample as following

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=basemap-gallery 

hp_1135.png

0 Kudos
ReneRubalcava
Esri Frequent Contributor

"reference-element" is the attribute name, only to be used declaratively.

"referenceElement" is the property name, which be accessed via "element.referenceElement". It would also be used in jsx syntax for various UI libraries.

https://developers.arcgis.com/javascript/latest/programming-patterns/#attributes-and-properties