But why? Of course setVisible works on listview, why wouldn't it? The
problem is that you are adding the list view to target. You should add a
component that contains the listview.
Matej, ListView is a component conceptually equal to Label, TextField or whatever. The code I sent doesn't work. And yes I'm adding it to a target, the same way I do for a Label which works fine without adding it to a parent component.
On 5/18/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
Bruno Borges wrote:
> One thing at a time:
>
> 1) setVisible works, when not doing through Ajax components like AjaxLink;
>
> 2) ListView outputs one different id for each repeated line.
>
> 3) when calling ListView.setVisible(false) from some
> onClick(AjaxRequestTarget), it does not works.
>
> So pay attention to 3': setVisible can be called from anywhere that
> ListView does not have to know about. And this problem I'm talking
> about, it's been called from an Ajax component. This let me conclude
> that this code should work:
>
> ...
> final ListView listView = new ListView("list", items) { ... };
> listView.setOutputMarkupId(true);
> add(listView);
> final Label label = new Label("foo", new Model("Foo"));
>
> AjaxFallbackLink link = new AjaxFallbackLink("ajaxLink") {
> public void onClick(AjaxRequestTarget target) {
> listView.setVisible(false);
> label.setVisible (false);
>
> target.addComponent(label); // this one works
> target.addComponent(list); // this does NOT works
> }
> };
> add(link);
> ...
>
> The way setVisible(false) is been called should not be important on how
> the component must behave. If it should, so in the javadoc would be
> needed to have some comment warning the user about that. " Do not call
> setVisible(false) from Ajax components."
But why? Of course setVisible works on listview, why wouldn't it? The
problem is that you are adding the list view to target. You should add a
component that contains the listview.
-Matej
>
> That's what I think.
>
> On 5/18/06, *Alvar Lumberg* <[EMAIL PROTECTED]
> <mailto: [EMAIL PROTECTED]>> wrote:
>
> yea, my bad. I was thinking about ajax side of things, sorry.
>
> On 5/18/06, Johan Compagner < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > setVisible doesn't work?
> > It should work fine listview will not get rendered when you set
> it to none
> > visible.
> >
> > And yes (talking to igor) i think it is a bit stupid that we do
> generate the
> > items when the listview is not visible..
> >
> > johan
> >
> >
> >
> > On 5/18/06, Alvar Lumberg < [EMAIL PROTECTED]
> <mailto: [EMAIL PROTECTED]>> wrote:
> > >
> > Bruno, your problem is more of an issue with code beauty and
> design? I
> > agree that it's a bit misleading to have an setVisible method that
> > does nothing... As adding a fairly synthetic AjaxComponent
> subclass to
> > Component for using as a parent for every ajax-enabled component
> > doesn't seem justified, what if ListView (and other possible
> > repeaters) would throw UnsupportedOperationException or something
> like
> > that?
> >
> > Of course, that would mean making Component.setVisible not final...
> >
> > Alvar
> >
> > On 5/18/06, Igor Vaynberg < [EMAIL PROTECTED]
> <mailto: [EMAIL PROTECTED]>> wrote:
> > > i disagree,
> > > wicket's primary usecase is not ajax, but regular rendering.
> ajax is a
> > very
> > > nice bonus and does not always work as smoothly as we would like.
> > >
> > > now the ajax solution for the listview is quiet easy, put it into a
> > > webmarkupcontainer and update that container instead of the
> listview via
> > > ajax
> > >
> > > WebMarkupContainer listviewcontainer=new
> > > WebMarkupContainer("listviewcontainer");
> > > ListView listview=new ListView("listview", .....
> > >
> > > listviewContainer.add (listview);
> > >
> > > <span wicket:id="listviewcontainer"><ul><li
> > > wicket:id="listview">blah</li></ul></span>
> > >
> > > ... target.addComponent(listviewcontainer);
> > >
> > > this has the added advantage of hiding the listview's
> container, be that a
> > > ul or a table
> > >
> > > -Igor
> > >
> > >
> > >
> > > On 5/17/06, Bruno Borges < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > > >
> > > >
> > > > > one thing we might try is to add an isvisible check to
> > > internalOnAttach() so that lsitview does not create children if
> it is not
> > > visible. johan what do you think?
> > > > >
> > > >
> > > >
> > > > Igor, the problem is that we need to make possible the call for
> > > setVisible(false), just like any other component... _after_ the
> component
> > > was printed out (for example, hidding a list view within an
> AjaxLink).
> > > >
> > > > If this can't be done, ListView must be of other type except
> Component.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On 5/17/06, Igor Vaynberg <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > >
> > > > > > Sure, I know about that, but the way we code for other
> things like
> > > Label or TextField, it works, right? So, for ListView it should
> work too.
> > > It's a component just like other.
> > > > >
> > > > >
> > > > >
> > > > > listview is very much different from ordinary components
> like label
> > and
> > > textfield. listview is a repeater. repeaters have no markup of
> their own
> > and
> > > they produce no markup.
> > > > >
> > > > > the markup you assign to the listview using wicket:id the
> listview
> > > delegates to its children. the markup you see in the output
> generated by
> > > listview does not come from the listview itself, but from its
> children
> > that
> > > render themselves.
> > > > >
> > > > > one thing we might try is to add an isvisible check to
> > > internalOnAttach() so that lsitview does not create children if
> it is not
> > > visible. johan what do you think?
> > > > >
> > > > > -Igor
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Bruno Borges
> > > > Summa Technologies
> > >
> > >
> >
> >
> > -------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services,
> security?
> > Get stuff done quickly with pre-integrated technology to make
> your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> >
> http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642 <http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642>
> >
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> <mailto: Wicket-user@lists.sourceforge.net>
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642 <http://sel.as-us.falkag.net/sel?cmdlnk&kid0709&bid&3057&dat1642 >
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> <mailto: Wicket-user@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>
>
> --
> Bruno Borges
> Summa Technologies
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Bruno Borges
Summa Technologies