10bestdesign / jqvmap

jQuery Vector Map Library
https://www.10bestdesign.com/jqvmap/
Other
1.82k stars 681 forks source link

'selectedRegions' option does not work with double-quoted input: ["MX"] #356

Open fraballi opened 4 years ago

fraballi commented 4 years ago

Dear colleagues, I need to load input data with Ajax dynamically and JS handles string arrays double-quoted so the map can't select regions.

Tried this, but the output is not correct:

//Note: 'data' is a model loaded via Ajax as: {"MX": "15.65", ..., }
       var keys = Object.keys(data).map(function (key) {
            return "'" + key + "'";   // Want: ['MX'], but get [" 'MX' "]
          });
   ...
       selectedRegions: keys.toString(),

Only setting static values works for me.

How can be done?