Select to view content in your preferred language

Collapsed/Expanded events for the Expand widget

639
1
Jump to solution
04-04-2023 05:36 AM
FredericGoulet1
New Contributor

Is there a way to have an event triggered when the Expand widget actually expand or collaspe ?

I would like to show or hide a DistanceMeasurement2D on the map accordingly. 

Thanks.

 

0 Kudos
1 Solution

Accepted Solutions
RamaniGanason
New Contributor III

This can be easily achieved using the watch function of the widget and the expanded state.

const bgExpand = new Expand({
   view: view,
   content: basemapGallery
});   
        
// create a watch to trigger an event whenever expanded value changes.
bgExpand.watch("expanded", (expanded) => {
   console.log(expanded);
}); 

View solution in original post

Tags (3)
1 Reply
RamaniGanason
New Contributor III

This can be easily achieved using the watch function of the widget and the expanded state.

const bgExpand = new Expand({
   view: view,
   content: basemapGallery
});   
        
// create a watch to trigger an event whenever expanded value changes.
bgExpand.watch("expanded", (expanded) => {
   console.log(expanded);
}); 
Tags (3)