Re: updating a label's model with ajax

2011-05-16 Thread wmike1...@gmail.com
Problem was resolved. I had some malformed html throwing things off. Thanks
for all the replies.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/updating-a-label-s-model-with-ajax-tp3525221p3526444.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: updating a label's model with ajax

2011-05-16 Thread Martin Grigorov
Looking at this it should just work.

On Mon, May 16, 2011 at 4:25 PM, wmike1...@gmail.com wrote:

> public class IncidentReportPanel extends Panel
> {
>public IncidentReportPanel(String id) {
>super(id);
>
>  final Model model = new Model("first model");
> final Label label = new Label("wicketTag", model);
> label.setOutputMarkupId(true);
> add(label);
>
>  AjaxLink update = new AjaxLink("updateButton") {
>public void onClick(AjaxRequestTarget target) {
>model.setObject("new model");
>label.setDefaultModel(model);
>
no need to call that. the model is already set

>target.addComponent(label);
>}
>};
>add(update);
> }
> }
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/updating-a-label-s-model-with-ajax-tp3525221p3526331.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
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com 


Re: updating a label's model with ajax

2011-05-16 Thread wmike1...@gmail.com
public class IncidentReportPanel extends Panel
{
public IncidentReportPanel(String id) {
super(id);

  final Model model = new Model("first model");
 final Label label = new Label("wicketTag", model);
 label.setOutputMarkupId(true);
 add(label);

  AjaxLink update = new AjaxLink("updateButton") {
public void onClick(AjaxRequestTarget target) {
model.setObject("new model");
label.setDefaultModel(model);
target.addComponent(label);
}
};
add(update);
 }
}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/updating-a-label-s-model-with-ajax-tp3525221p3526331.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: updating a label's model with ajax

2011-05-15 Thread Wilhelmsen Tor Iver
My guess: You have forgotten to call myLabel.setOutputMarkupId(true) or 
myLabel.setOutputPlaceholderTag(true) so the Ajax framework cannot find the 
element in the DOM.

mvh
- Tor Iver Wilhelmsen, Arrive AS


-Original Message-
From: wmike1...@gmail.com [mailto:wmike1...@gmail.com] 
Sent: 16. mai 2011 03:58
To: users@wicket.apache.org
Subject: updating a label's model with ajax

Hi all,

I'm looking to change the model of a label when a button is clicked. As of
now, I'm using an ajax button and doing target.addComponent(myLabel) inside
that button's onclick method. However, the text on the page doesn't change
when the button is clicked. This label happens to be hidable, and when i
hide it, then reshow it, the label is redisplayed with the new model. I'm
doing something wrong. What is going on here?

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/updating-a-label-s-model-with-ajax-tp3525221p3525221.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: updating a label's model with ajax

2011-05-15 Thread Martin Grigorov
Show us your code.

On Mon, May 16, 2011 at 3:58 AM, wmike1...@gmail.com wrote:

> Hi all,
>
> I'm looking to change the model of a label when a button is clicked. As of
> now, I'm using an ajax button and doing target.addComponent(myLabel) inside
> that button's onclick method. However, the text on the page doesn't change
> when the button is clicked. This label happens to be hidable, and when i
> hide it, then reshow it, the label is redisplayed with the new model. I'm
> doing something wrong. What is going on here?
>
> Thanks
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/updating-a-label-s-model-with-ajax-tp3525221p3525221.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
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com 


updating a label's model with ajax

2011-05-15 Thread wmike1...@gmail.com
Hi all,

I'm looking to change the model of a label when a button is clicked. As of
now, I'm using an ajax button and doing target.addComponent(myLabel) inside
that button's onclick method. However, the text on the page doesn't change
when the button is clicked. This label happens to be hidable, and when i
hide it, then reshow it, the label is redisplayed with the new model. I'm
doing something wrong. What is going on here?

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/updating-a-label-s-model-with-ajax-tp3525221p3525221.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