Hi all, 

I am using wicket-openlayers to produce maps. This works (mostly) like a charm. 

Now I have a problem, I want to get the map extent serverside, in order to 
produce a list of features within the bounds of the map. In order to get this, 
I need to get the map extent when the link is clicked, and therefore (afaik) I 
have to use Ajax. 

When the map page is loaded, I register an event listener to the link as 
follows (js): 

        this.addExternalClickListener = function(component, callback) {
                var self = this;
                Wicket.Event.add(component, 'click', function(event) {
                        if (event.type == 'click') {
                                self.onEvent(callback, {});
                        }                               
                });
        };

The onEvent method looks like this:
        this.onEvent = function (callBack, params) {
                params["center"] = this.map.getCenter();
                params["bounds"] = this.map.getExtent();
                params["zoom"] = 
this.map.getZoomForExtent(this.map.getExtent(), false);
                Wicket.Ajax.get({"u":callBack, "ep":params});
        };

This method (onEvent) is tested and is working for another feature. 
The component is calculated as follows serverside in a subclass of 
AbstractDefaultAjaxBehavior: getComponent().getMarkupId(), and the callback is 
computed using getCallbackUrl() in the same class. 

When this is debugged using Firebug, all looks fine and dandy, the event is 
added, and the extra parameters are computed correctly, as far as I can see. 

Then the erratic behavior starts: First time the Wicket.ajax.get is called, the 
page is reloaded, and all subsequent calls return the html for the map page.  

Any help is much appreciated!

Yours, 
Tron Walseth


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to