Comment on page
How do I change the order of control options?
After you add a control to your map, you might need to rearrange the order of buttons or dropdown options in that control. The best way to accomplish this is to use the
onlyoption in your control in the Advanced Editor.
onlyoption is used to restrict the available options in your control. Imagine we have a "Sector" field with the following values:
If we only want "Finance" and "Agriculture" to appear in our control, we could use the
onlyoption to do that:
// Restrict our filter options from many sectors down to just two:
only: "Finance", "Agriculture";
However, when you pass options to the
onlyproperty, Kumu will list the options on the map in the exact order you specified.
In our example above, imagine we want the order of our options to be "Finance", "Education", "Healthcare", and finally "Agriculture". To accomplish that, we can pass that list to the
// Allow all our possible options to show up on the map,
// but make sure they are in this specific order:
only: "Finance", "Education", "Healthcare", "Agriculture";