Re: update label using (Ajax)Link
Ernesto Reinaldo Barreiro-4 wrote: > > Yes you are right... but I think new PropertyModel(this, > "selectedEintrag.vorname") will work I guess. > I guess you are right. That will work, but it is not very elegant to put a reference to the page or panel into the model. He probably should not overwrite the reference on "selectedEintrag" or use the readonly model you suggested. I think I would put a new Model() into the label and then, instead of overwriting the variable "selectedEintrag", call label.setModelObject(item.getModelObject().getVorname()) - -- Regards, Hans http://cantaa.de -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3357001.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: update label using (Ajax)Link
Yes you are right... but I think new PropertyModel(this, "selectedEintrag.vorname") will work I guess. Ernesto On Tue, Mar 15, 2011 at 3:30 PM, Hans Lesmeister 2 wrote: > > Ernesto Reinaldo Barreiro-4 wrote: >> >> final Label vorname = new Label( "Vorname", new >> PropertyModel(selectedEintrag, "vorname")); >> > > This option will not work because: > > >> selectedEintrag = item.getModelObject(); >> > > The reference "selectedEintrag" is overwritten. > > > - > -- > Regards, > Hans > > http://cantaa.de > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3356751.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: update label using (Ajax)Link
Sorry @ all, I just forgot to restart the server so the approach with the AbstractReadOnlyModel is working! Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3356773.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: update label using (Ajax)Link
Thanks Ernesto for you quick reply. Unfortunatelly this is not working :( But if I debug within the onClick method of my AjaxLink item.getModelObject() returns null? Any idea why this happens? Or is this just a problem with my debugging configuration of eclipse? I would expect I can access "Eintrag" within the onClick method by using item.getModelObject()? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3356755.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: update label using (Ajax)Link
Ernesto Reinaldo Barreiro-4 wrote: > > final Label vorname = new Label( "Vorname", new > PropertyModel(selectedEintrag, "vorname")); > This option will not work because: > selectedEintrag = item.getModelObject(); > The reference "selectedEintrag" is overwritten. - -- Regards, Hans http://cantaa.de -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3356751.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: update label using (Ajax)Link
I think you label model is never "updated".Can you try final Label vorname = new Label( "Vorname", new AbstractReadOnlyModel() { private static final long serialVersionUID = 1L; public String getObject() { return selectedEintrag.getVorname()); }; }); or final Label vorname = new Label( "Vorname", new PropertyModel(selectedEintrag, "vorname")); Regards, Ernesto On Tue, Mar 15, 2011 at 2:34 PM, hrbaer wrote: > Hi, > > I try to update a component ("vorname" within my example) once the user > click on a link within a table. > (In fact it doesn't matter if it is an ajax link or a "normal" one. My > example is using an ajax link.) > > This im my JAVA code: > > public class Test extends WebPage { > > private Eintrag selectedEintrag = new Eintrag(); > > public Test( PageParameters parameters ) { > > ArrayList listEintraege = ladeEintraege( parameters ); > > final Label vorname = new Label( "Vorname", > selectedEintrag.getVorname() > ); //just empty in first instance > auswahlVorname.setOutputMarkupId( true ); > add( auswahlVorname ); > > add( new ListView( "List", listEintraege ) { > > protected void populateItem( final ListItem item ) { > > Eintrag eintrag = item.getModelObject(); > item.add( new Label( "Info", eintrag.getInfo() ) ); > item.add(new AjaxFallbackLink("Details_Link"){ > > @Override > public void onClick( AjaxRequestTarget target ) { > > selectedEintrag = item.getModelObject(); > target.addComponent( vorname ); > > } > > }); > > } > > }); > > } > > } > > > Can anybody provide me some information's why this is not working (no update > at all)? > Isn't it possible to bind my Label component to a private property and > update this property during the onclick method? > > Thanks in advance. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3356575.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
update label using (Ajax)Link
Hi, I try to update a component ("vorname" within my example) once the user click on a link within a table. (In fact it doesn't matter if it is an ajax link or a "normal" one. My example is using an ajax link.) This im my JAVA code: public class Test extends WebPage { private Eintrag selectedEintrag = new Eintrag(); public Test( PageParameters parameters ) { ArrayList listEintraege = ladeEintraege( parameters ); final Label vorname = new Label( "Vorname", selectedEintrag.getVorname() ); //just empty in first instance auswahlVorname.setOutputMarkupId( true ); add( auswahlVorname ); add( new ListView( "List", listEintraege ) { protected void populateItem( final ListItem item ) { Eintrag eintrag = item.getModelObject(); item.add( new Label( "Info", eintrag.getInfo() ) ); item.add(new AjaxFallbackLink("Details_Link"){ @Override public void onClick( AjaxRequestTarget target ) { selectedEintrag = item.getModelObject(); target.addComponent( vorname ); } }); } }); } } Can anybody provide me some information's why this is not working (no update at all)? Isn't it possible to bind my Label component to a private property and update this property during the onclick method? Thanks in advance. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/update-label-using-Ajax-Link-tp3356575p3356575.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org