[
https://issues.apache.org/jira/browse/WICKET-4860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493912#comment-13493912
]
Sven Meier commented on WICKET-4860:
------------------------------------
I've attached a possible solution, see AjaxJQueryEventBehavior.java. It
attaches an event handler to a jquery widget.
Usage:
<span style="cursor:pointer;color:blue;text-decoration: underline;"
id="jqueryFilter">
Click Here To Do Custom Ajax Behavior Filter
</span>
<span wicket:id="jqueryFilterDelegate"></span>
WebMarkupContainer filterDelegate = new
WebMarkupContainer("jqueryFilterDelegate");
filterDelegate.add(new AjaxJQueryEventBehavior("#jqueryFilter", "click") {
@Override
protected void onEvent(AjaxRequestTarget _target) {
_target.add(getResultsComponent());
}
});
add(filterDelegate);
Beware, it's just an idea to get you started.
> links do not resolve properly in custom ajax update
> ----------------------------------------------------
>
> Key: WICKET-4860
> URL: https://issues.apache.org/jira/browse/WICKET-4860
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9
> Environment: windows 7, intellij 11.1.4, jdk 1.6.0_30, jetty
> Reporter: Simon Botting
> Priority: Minor
> Attachments: AjaxJQueryEventBehavior.java, wicket-issue-1.tar.gz
>
>
> I've got a page that has a filter widget in it and a summary list of results
> that correspond to the filter criteria.
> When the page initially renders the widget and the default results show.
> When the filter is changed and an "apply filter" button is clicked, the
> results update.
> The results are displayed through a ListView, one of the components added to
> each ListItem is a link.
> This link resolves fine for the default results but when the filter widget is
> changed and the results updated, the link does not resolve.
> I've attached a quickstart that shows this:
> To replicate the error:
> Click the link "List Gromets" above.
> You will see a page with a list of ten items, the url of the page is
> something like
> http://localhost:8080/wicket/bookmarkable/wicketissue1.pages.ListGrometsPage?5
> Mouseover one of the links in the list and the url will be something like:
> http://localhost:8080/wicket/page?5-1.ILinkListener-results-gromets-0-displayGrometLink
> the actual url in the link is:
> ../page?5-1.ILinkListener-results-gromets-0-displayGrometLink
> Click the link and it will resolve properly and display a Gromet display page
> Go back to the "List Gromets" page
> Click the "pseudo" ajax link "Click Here To Do Custom Ajax Behavior Filter"
> The results will update.
> Mouseover one of the links in the list and the url will be something like:
> http://localhost:8080/wicket/bookmarkable/page?53-1.ILinkListener-results-gromets-0-displayGrometLink
> the actual url in the link is:
> ./page?53-1.ILinkListener-results-gromets-0-displayGrometLink
> Click the link and it will not resolve properly and produce a page not found.
> The issue is that when the results are updated through ajax using an
> AbstractAjaxBehavior "GrometFilterResultsBehavior" the links don't resolve
> properly.
> In the first case the urls are written out with "../" and in the second just
> "./" I assume this is something to do with the context of the ajax call to
> the server.
> I've looked at the Link getUrl() and Link.urlFor() which in turn calls up
> Component and RequestCycle.
> I don't know whether this is an issue with ajax or simply something that I'm
> doing wrong or not understanding properly about the way wicket works.
> As an aside I've added a standard ajax link updating the results and that
> works fine
> Let me know if you need any more information.
> Cheers
> Simon
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira