Every one of you seem's to have a different answer, but I'm not sure which
one is the best...
So, the solution I decided to use is a mix. I still use my fragment,
override the isVisible method. (So it can be used to know if it is visible
or not.) I can't override setVisible(), but created a method named
toggleVisibility() which is setting visibility for each child of this
fragment... It is not as clean as I would have wanted, but at least, now,
the fragment can disappear ant some markup are still there to be updated.
Thanks a lot...
Marc
On 1/16/07, Erik van Oosten <[EMAIL PROTECTED]> wrote:
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
-------------------------------------------------------------------------
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