[ 
https://issues.apache.org/jira/browse/WICKET-4860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494109#comment-13494109
 ] 

Simon Botting edited comment on WICKET-4860 at 11/9/12 4:51 PM:
----------------------------------------------------------------

Hi Sven, thanks for your suggestions I had a look at them and tried a few 
variations and came up with the following (attached as 
GrometFilterResultsBehavior4.java GrometFilterResultsBehavior4Init.js) 

Then in my client page I added the following code: 

 Label filterButton4 = new Label("ajaxBehaviorFilterButton4", "Do Custom 
AbstractStandardAjaxBehavior with wicketAjaxGet Filter");
      filterButton4.setOutputMarkupId(true);
      filterButton4.add(new GrometFilterResultsBehavior4() {
         @Override
         protected void respond(AjaxRequestTarget _target) {
            log.debug("responding extended AbstractEventBehavior");
            _target.add(getResultsComponent());
         }
      });

This seemed to work fine.

My one question is whether the file

GrometFilterResultsBehavior4Init.js

Which calls wicketAjaxGet is the best way to do the calling of the server, in 
the app code I'd add the filter criteria by

doing 

var myFilterCriteria = callToComplicatedJqueryWidget();

wicketAjaxGet("${callbackUrl}&" + myFilterCriteria,
      function() {}.bind(theTarget),
      function() {}.bind(theTarget),
      null);

Is this the best way to do it, in your suggestion code  in the 
AjaxJQueryEventBehavior you write the client call through the renderHead method 
as follows: 

String javascript = String.format("$('%s').bind('%s', function(_event) { %s 
});",selector, event, getCallbackScript());

response.renderOnDomReadyJavaScript(javascript);

but this prevents me from adding any "GET" data which has the filter criteria, 
thats the reason I use the TextTemplate and my own init javascript file.

Any suggestions?

Cheers
Simon
                
      was (Author: sbotting):
    Hi Sven, thanks for your suggestions I had a look at them and tried a few 
variations and came up with the following (attached as 
GrometFilterResultsBehavior4.java GrometFilterResultsBehavior4Init.js) 

Then in my client page I added the following code: 

 Label filterButton4 = new Label("ajaxBehaviorFilterButton4", "Do Custom 
AbstractStandardAjaxBehavior with wicketAjaxGet Filter");
      filterButton4.setOutputMarkupId(true);
      filterButton4.add(new GrometFilterResultsBehavior4() {
         @Override
         protected void respond(AjaxRequestTarget _target) {
            log.debug("responding extended AbstractEventBehavior");
            _target.add(getResultsComponent());
         }
      });

This seemed to work fine.

My one question is whether the file

GrometFilterResultsBehavior4Init.js

Which calls wicketAjaxGet is the best way to do the calling of the server, in 
the app code I'd add the filter criteria by

doing 

var myFilterCriteria = callToComplicatedJqueryWidget();

wicketAjaxGet("${callbackUrl}&" + myFilterCriteria,
      function() {}.bind(theTarget),
      function() {}.bind(theTarget),
      null);

Is this the best way to do it, in your suggestion code you simply add 
getCallbackJavascript() but this prevents me from adding any "GET" data which 
has the filter criteria.

Cheers
Simon
                  
> 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, 
> GrometFilterResultsBehavior4.java, GrometFilterResultsBehaviorInit4.js, 
> 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

Reply via email to