You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by HHB <hu...@yahoo.ca> on 2009/04/23 12:37:42 UTC

How to set content of an ajax enabled link?

Hey,
Is there a way to set the content of a link 
dynamically (the value is coming from model object)?
The link has to be Ajax enabled for sure.
Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to set content of an ajax enabled link?

Posted by Martin Grigorov <mg...@apache.org>.
Use your own Link/AjaxLink and add the logic.
See the code in Wicket 1.5 for inspiration.

On Tue, Oct 23, 2012 at 12:48 PM, cosmindumy <co...@yahoo.com> wrote:
> We are using Wicket 1.4.18.
> There is no setBody method on abstract link.
> Is there any possiblity?
> Thanks.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-set-content-of-an-ajax-enabled-link-tp1882634p4653258.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to set content of an ajax enabled link?

Posted by cosmindumy <co...@yahoo.com>.
We are using Wicket 1.4.18. 
There is no setBody method on abstract link. 
Is there any possiblity?
Thanks. 



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-set-content-of-an-ajax-enabled-link-tp1882634p4653258.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to set content of an ajax enabled link?

Posted by Martin Grigorov <mg...@apache.org>.
See AbstractLink#setBody(IModel<String>)

On Tue, Oct 23, 2012 at 12:16 PM, cosmindumy <co...@yahoo.com> wrote:
> Hi,
> How can I set the text inside a ajaxlink. I use a table and on populateItem
> on AbstractColumn I add a link.
> I don't want to use another component with onclick ajax behavior.I also
> cannot add a child to ajaxlink. I do not have control on it on html. Here is
> the code.
>
> public void populateItem(final Item<ICellPopulator<UserDetailsVO>> item,
> final String componentId, final IModel<UserDetailsVO> rowModel)
>         {
> item.add(new AjaxLink { ... });
> }
>
> Thanks.
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-set-content-of-an-ajax-enabled-link-tp1882634p4653254.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to set content of an ajax enabled link?

Posted by cosmindumy <co...@yahoo.com>.
Hi,
How can I set the text inside a ajaxlink. I use a table and on populateItem
on AbstractColumn I add a link. 
I don't want to use another component with onclick ajax behavior.I also
cannot add a child to ajaxlink. I do not have control on it on html. Here is
the code. 

public void populateItem(final Item<ICellPopulator&lt;UserDetailsVO>> item,
final String componentId, final IModel<UserDetailsVO> rowModel)
        {
item.add(new AjaxLink { ... });
}

Thanks. 
            



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-set-content-of-an-ajax-enabled-link-tp1882634p4653254.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to set content of an ajax enabled link?

Posted by Liam Clarke-Hutchinson <li...@steelsky.co.nz>.
By content you mean the text yeah? Create your link (We use
AjaxFallbackLinks for Ajax links, but there's others), and then create
a label with an appropriate model, and add the label to the link.
You're markup would look like so:

<a href="#" wicket:id="ajaxLink"><span wicket:id="linkContent"></span></a>

How dynamic a content you're after really depends on what you're
doing. If you're not using a dynamic model (I'm a big fan of property
models over domain objects) you could easily change the Model of the
linkContent label in the ajaxLink's onUpdate method. Just make sure
you add the link to the ajaxRequestTarget to see it update.

If you want a more specific model behaviour, not too hard to knock up
a class implementing IModel that does what you need.

Regards,

Liam Clarke

On 4/23/09, HHB <hu...@yahoo.ca> wrote:
> Hey,
> Is there a way to set the content of a link
> dynamically (the value is coming from model object)?
> The link has to be Ajax enabled for sure.
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org