Another option is to:
- attach a AjaxFallbackLink to the arrow,
- override the onClick method,
- in the method replace the component you want to hide with the one you 
want to show:
  compToHide.replaceWith(compToShow);
- then finish the method with:
   if (target != null) { target.addComponent(compToShow); }

You now have changed the page structure. Upon the re-render the new 
component is displayed (non-ajax browser). But in the last step you 
enable an Ajaxified replace as well.

I recently wrote an article about this on my blog: 
http://day-to-day-stuff.blogspot.com/2007/01/backward-compatible-ajax-development.html

Have fun,
    Erik.


Martijn Dashorst wrote:
> For individual elements, where you don't mind having all markup
> already in the source of the page:
>
> Hiding:
> ajaxrequesttarget.appendJavaScript("document.getElementById('" +
> component.getMarkupId() + "').style.display = 'none';");
>
> Showing:
> ajaxrequesttarget.appendJavaScript("document.getElementById('" +
> component.getMarkupId() + "').style.display = '';");
>
> Otherwise, put everything in the panel, and update the whole panel
> whilst setting the visibility flags of the child components:
>
> class MyPanel extends Panel {
>     private WebMarkupContainer normalView;
>     private WebMarkupContainer detailedView;
>     private AjaxLink showDetails;
>     private AjaxLink hideDetails;
>
>     MyPanel() {
>         .......
>         add(showDetails = new AjaxLink("showDetails") {
> onClick(AjaxRequestTarget t) {
>             normalView.setVisible(false);
>             hideDetails.setVisible(true);
>             detailedView.setVisible(true);
>             setVisible(false);
>             t.addComponent(MyPanel.this);
>         }});
>
> The rest is left as an exercise to the reader.
>
> Martijn
>   

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to