Hi Personally, I vote for alternative 3 :-)
the link is not an ajax link, but a normal link. this is because a new popup is needed, and the AjaxLink class doesn't have popup fuctionality, but the normal link has. Is it a problem to have an empty onClick-method on a normal link, and add an ajax behavior to the link, where all logic is executed? Tron ________________________________________ Fra: Martin Grigorov [[email protected]] Sendt: 5. mars 2013 11:41 Til: [email protected] Emne: Re: Strange wicket ajax behavior Hi, I see three options: 1) the Ajax request calls AbstractDefaultAjaxBehavior#respond(AjaxRequestTarget) and there the page is added for repaint. 2) the page is either expired (or even not stored at all, check the server logs for any exceptions) and the Ajax call cannot find the page and the component with the Ajax behavior If IPageSettings#getRecreatePageAfterExpiry() is true then a new page instance will be created and rendered 3) the page instance has been re-rendered in a different tab/window and any request from the first tab/window will lead to PageStaleException (see PageProvider#getPageInstance() and the check for renderCount in it) On Tue, Mar 5, 2013 at 12:23 PM, Tron Walseth <[email protected]> wrote: > 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: [email protected] > For additional commands, e-mail: [email protected] > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
