ToggleButton in ToolbarMenu

1. A concise explanation of the problem you’re experiencing.

Hello, I need to add some ToggleButtons to my toolbar menu.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

// ToggleButton I use normally.

’ Enable light’,
function(checked) {
viewer.scene.globe.enableLighting = checked;

//ToolbarMenu where I want to add my ToggleButton.

text : ‘This should be replaced with a ToggleButton’,
}], ‘toolbar’);

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I need to create a kind of DropDownList with checkboxes (ToggleButtons). Is there any way? Thanks in advance.

4. The Cesium version you’re using, your operating system and browser.

CesiumJS 1.60

Windows 7

Mozilla Firefox 68.0.2

This Sandcastle has an example of toggle buttons:

Note that this works in Sandcastle, because of the additional helper functions there, but wouldn’t work in a web app that just includes the CesiumJS library.

Thanks for your reply. I need to add CheckBoxes in the DropDownList.

So I can open the list by clicking it, select the ToggleButtons and then close the list.

Is it possible? Thanks.

You should be able to create any HTML UI you need and just listen for changes to that. There’s nothing specific or unique to CesiumJS there. For example this Stackoverflow answer has some suggestions on doing this:

And then you can have that affect your CesiumJS scene when the selection is made.

You’re right, thank you!