Bug #12

avatar

Can't show multiple maps on a page

Added by Mathieu Comandon 109 days ago. Updated 55 days ago.

Status:New Start:05/18/2010
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:- Spent time: -
Target version:-

Description

I suppose this bug as something to do with the line in the Readme file :
correct javascript files that suppose that the map's javascript object is called 'map'

I've tried changing parameters while instantiating a new map like this :
$this->gMap = new GMap(array(),array(),array('id' => 'recherche_map'),array('js_name' => 'recherche_map', 'onload_method' => 'jQuery'));

Firebug shows me that the map name is 'recherche_map' instead of just map. Everything works fine (this map is displayed on every page of the website and is included in a component)

I have another page were I want to display another map, it's instantiated like the other one:
$this->gMap = new GMap(array(),array(),array('id' => 'localisation_map'),array('js_name' => 'localisation_map', 'onload_method' => 'jQuery'));

This new map shows up fine but then 'recherche_map' is not here anymore, the variable is 'null' when I look with Firebug.

I suppose you may already be aware of this bug, but is there a quick workaround that would allow me to wait an official fix ?

multiple-maps.patch - Patch for showing multiple maps (1.3 KB) Mathieu Comandon, 07/11/2010 05:10 PM

History

Updated by Fabrice Bernhard 57 days ago

avatar

Did you try hacking the "initialize" function to give it another name ?

cf http://groups.google.com/group/symfony-users/browse_thread/thread/1bac4174fb4ad154

Updated by Mathieu Comandon 55 days ago

avatar

giving a different 'initialize' function for different maps works. I made a quick fix to pass the init function name as a parameter. it's far for being perfect, it doesn't work with the 'js' onload method (it gets overwritten everytime a new map is created) but with jquery it's working just fine.

I've attached the patch, I'll try pushing in on Github once I've figured out how to do it (I'm used to Launchpad).

Also available in: Atom PDF