jQuery-Mapael
jQuery-Mapael copied to clipboard
Delete dynamically added plots and show new dynamic plots
Greetings! So I have stumbled upon a problem while wanting to delete plots. I have set $('.container).trigger('update',[{deletePlotKeys:'all',newPlots: myPlots}]) , and that works but I get this error while hover over new plots: "TypeError: elem.mapElem.attrsHover is null". Can you help me with this please?
P.S. I tried "deletePlotKeys: oldPlots", but that does nothing. I'm guessing that I can't delete dynamically added plots.
Mapael does this:
for (; i < opt.deletePlotKeys.length; i++) {
if (self.plots[opt.deletePlotKeys[i]] !== undefined) {
fnRemoveElement(self.plots[opt.deletePlotKeys[i]]);
delete self.plots[opt.deletePlotKeys[i]];
}
}
So you need to pass the old keys as an array:
opt = {
deletePlotKeys: Object.keys(old_plot_points),
newPlots: plot_points
}
$("#worldmap").trigger('update', [opt]);
Not sure why "all" doesn't work properly