0

GMaps 3.0.1 and ZK 6.5.3

asked 2013-10-23 14:09:41 +0800

marcocompagnin gravatar image marcocompagnin
1 1

updated 2013-10-23 14:13:43 +0800

Hi all, i am using Zk 6.5.3 CE and GMaps 3.0.1 testing locally. I have a problem using the onClickMap or onClick method to display the GInfo for a GMarker.

I tried everything i read in the topic but nothing happens.

Here some code: - I use the onClick attribute on ZUL file: <script type="text/javascript" content="zk.googleAPIkey='KEY'"/> <gmaps id="mappa" showsmallctrl="true" showtypectrl="true" zoom="14" visible="false"> <attribute name="onClick"> <attribute name="onMapClick"> </gmaps>

  • i tried to use the event even in the Java code, in every Gmarker i create dinamically or in the GMaps

@Listen("onClick = #mappa") public void onClick(){ log.info("map 3"); }

@Listen("onMapClick = #mappa")
public void onMapClick(MapMouseEvent event) {
    log.info("map 2");
    Gmarker gmarker = event.getGmarker();
    if(gmarker != null) {
        gmarker.setOpen(true);
    }
}

mappa.setZoom(10); mappa.setWidth("450px"); mappa.setHeight("600px"); GMarker marker = new Gmarker("

"+bookStoreList.get(j).getDesc()+"
"+"
"+bookStoreList.get(j).getAdditionalInfo()+"
",lat,lng);

                }
                log.info("link "+link+" "+sessioneId);

                marker.setAnchor(lat, lng);
                //marker.setOpen(true);
                marker.setVisible(true);
                marker.addEventListener("onClick", new EventListener(){
                    public void onEvent(Event event) throws Exception {
                        log.info("Entrato");
                        if((event.getTarget()) instanceof Gmarker){
                            log.info("ok opero");
                            boolean aperto = ((Gmarker)event.getTarget()).isOpen();
                            ((Gmarker)event.getTarget()).setOpen(!aperto);
                        }
                    }
                });

                marker.addEventListener("onMapClick", new EventListener(){
                    public void onEvent(Event event) throws Exception {
                        log.info("Entrato");
                        if((event.getTarget()) instanceof Gmarker){
                            log.info("ok opero");
                            boolean aperto = ((Gmarker)event.getTarget()).isOpen();
                            ((Gmarker)event.getTarget()).setOpen(!aperto);
                        }
                    }
                });

mappa.appendChild(marker);

The map work correctly and is displayed like it should, but when i click in a marker if i look into the console from the browser i see clearly this erro:

Uncaught TypeError: Cannot read property 'getBoundingClientRect' of undefined

Can you lend me a hand?

If i click everywhere in the page, except for the map object, i can get the @listen("onClick" #mappa) method,

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-10-23 14:09:41 +0800

Seen: 25 times

Last updated: Oct 23 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More