Nah, both have different semantics: the first removes/replaces the whole markup of the component, the other only makes it invisible. There are several options to do that, so I'd rather have this outlined as an example.
Martijn On 2/17/07, Johan Compagner <[EMAIL PROTECTED]> wrote: > can't we make this behaviour somehow default in our ajax request? > Then it always works i guess? > > johan > > > On 2/17/07, Martijn Dashorst < [EMAIL PROTECTED]> wrote: > > Or you could > > > > target.appendJavascript(" document.getElementById('" + > > component.getMarkupId() + "').style.display='none';"); > > > > Martijn > > > > On 2/16/07, Igor Vaynberg <[EMAIL PROTECTED] > wrote: > > > you cannot add button directly to the ajax target to change visibility, > you > > > have to add some enclosing component > > > > > > lets say you start out with a visible button > > > you hide it > > > and add it directly > > > so now what wicket will try to do is to go find > > > > > > <input id="button"/> and replace that tags outer html with "" - which > may or > > > may not work depending on the browser. btw do you have > > > button.setoutputmarkupid(true) ??? > > > > > > even if that does work lets say later you want to make the button > visible > > > again, so you add it again to the target > > > > > > wicket tries to go out and find a tag with id "button" but cant because > it > > > is no longer in the domtree of the body - so you get an error. > > > > > > the proper way to do this is to add button's parent, that way the parent > > > will repaint itself without the button's tag in it, and later when you > make > > > it visible the parent will repaint itself with button's tags so > everything > > > works nicely. > > > > > > -igor > > > > > > > > > > > > On 2/16/07, Alex Objelean < [EMAIL PROTECTED]> wrote: > > > > > > > > The bug is about setVisible() method which does not work on button > (and > > > not > > > > only) components when using ajax updates. > > > > > > > > Detailed description: > > > > I have a DataView. Each line contains a description (Label component), > a > > > > configuration select (DropDownChoice component) and a download button > > > > (Button component). When user changes the configuration from the > > > > DropDownChoice component, depending on the selected configuration - > the > > > > download button visibility must be changed. Here is the snippet of > code: > > > > > > > > protected void onUpdate(final AjaxRequestTarget target) { > > > > //find somehow my button using relative path > > > > Button button = ...; > > > > button.setVisible(false); > > > > target.addComponent(button); > > > > } > > > > > > > > This code does not perform the expected result. Interesting is that if > > > > instead of button, I try to change the visibility of a DropDownChoice > > > > component - it works! > > > > > > > > I cannot understand why it behave so different. Can you explain me? Is > it > > > a > > > > bug? Am I using a wrong approach? > > > > > > > > Thank you! > > > > -- > > > > View this message in context: > > > > http://www.nabble.com/Wicket-1.2.4-bug-%28-%21-%29---changing-visibility-of-a-button-using-ajax-tf3242268.html#a9013073 > > > > Sent from the Wicket - User mailing list archive at Nabble.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 > > > > > > > > > > > > -- > > Learn Wicket at ApacheCon Europe: http://apachecon.com > > Join the wicket community at irc.freenode.net: ##wicket > > Wicket 1.2.5 will keep your server alive. Download Wicket now! > > http://wicketframework.org > > > > > ------------------------------------------------------------------------- > > 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 > > -- Learn Wicket at ApacheCon Europe: http://apachecon.com Join the wicket community at irc.freenode.net: ##wicket Wicket 1.2.5 will keep your server alive. Download Wicket now! http://wicketframework.org ------------------------------------------------------------------------- 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