I've a question about region selections. I've created a function to switch the selected region in a different way like regionsSelectable()
. By using regionsSelectable()
I can select more than one region, with my function I want to switch the selected region to the current selected region (only one region is selected every time).
To realise this I've used the function clearSelectedRegions()
if length of SelectedRegions() > 1
after these all regions are deselected. I've saved the newest region in a separate variable.
To show the current region as a selected region I've changed two values.
(container is the map object, GER is the example region)
firstly: container.regions.GER.element.isSelected = false;
secondly: container.regions.GER.element.setSelected(true);
But these is a bad way to change a lot of regions...
So the question is, how can I change the same values by using setSelectedRegions()
?
This problem can be fixed using the regionsSelectableOne: true
command. Both the regionsSelectable and regionsSelectableOne need to be set to true, such as follows:
map: 'world_mill_en',
series: {............},
regionsSelectable: true,
regionsSelectableOne: true,
Hope this helps. Even though this is a easy way of doing it, I myself would be interested to know how it can be done using the clearSelectedRegions() and setSelectedRegions() options/functions. Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With