Select to view content in your preferred language

General question: Using API-documentation and EXPAND-Widget

86
2
Jump to solution
Tuesday
KaiBehncke
New Contributor III

Dear users,

I`m still on my way to learn "ArcGIS Maps SDK JS".

I have successfully created an Expand-widget like:

 

const expandbutton = new Expand({
  view: view,
  content: "<br><b>Legende</b><br>",
  label: "Legende",
  id: "legendendings",
  expandTooltip:"Legende",
  expanded:false,
  container: document.createElement("div")
});

view.ui.add(expandbutton, "bottom-right");

 

In the API-documentation (https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html) I find the "on"-function.

I would like to test it like:

 

expandbutton.on("click", function(event){
 alert ("hello");
});

 

...but if I lick on the expandbutton no "hello" appears. Do I misunderstand someting?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Regular Contributor

The "click" event is not available in the expand widget. Instead, I would recommend watching the "expanded" property, as shown in the code snippet below.

expandbutton.watch("expanded", (value)=>{
  console.log(`expanded: ${value}`);
})

 

View solution in original post

2 Replies
AnneFitz
Esri Regular Contributor

The "click" event is not available in the expand widget. Instead, I would recommend watching the "expanded" property, as shown in the code snippet below.

expandbutton.watch("expanded", (value)=>{
  console.log(`expanded: ${value}`);
})

 

KaiBehncke
New Contributor III

Thank you very much 🙂

0 Kudos