Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change current selected region after clearSelectedRegions()

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()?

like image 908
Dante_Gabriel Avatar asked Nov 08 '12 11:11

Dante_Gabriel


1 Answers

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.

like image 200
Mike Avatar answered Sep 25 '22 10:09

Mike