You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ashika Umanga Umagiliya <au...@biggjapan.com> on 2010/01/20 10:10:44 UTC

DataTable : Link with dynamically chaning label

Greetings ,

I have implemented  'AbstractColumn' to display list of 'id's and when 
user click on a 'id',it should take to the Page relevant to that 'id'.

But in the application, the tablecells just display "[Cell]" and I want 
to display an anchor (<a>) with the dynamically changing label .
How can i archive this?

Thanks in advance.

populateItem() method of AbstractColumn :

public void populateItem(Item<ICellPopulator<Family>> cellitem,String 
cellid, IModel<Family> model){

  final Family f = model.getObject();
  String id=f.getFamilyId(); //what to display this is an anchor
 
 Link alink = new Link(cellid) {
   @Override
    public void onClick() {
        setResponsePage(new SubFamiliesPage(f));
    }
};
cellitem.add(alink);
}

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


Re: DataTable : Link with dynamically chaning label

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Did you search the list? A very similar question was asked just a few days
ago...

http://old.nabble.com/How-to-get-a-cell-work-as-a-link-in-AjaxFallbackDefaultDataTable-td27161378.html

Regards,

Ernesto

On Wed, Jan 20, 2010 at 10:10 AM, Ashika Umanga Umagiliya <
aumanga@biggjapan.com> wrote:

> Greetings ,
>
> I have implemented  'AbstractColumn' to display list of 'id's and when user
> click on a 'id',it should take to the Page relevant to that 'id'.
>
> But in the application, the tablecells just display "[Cell]" and I want to
> display an anchor (<a>) with the dynamically changing label .
> How can i archive this?
>
> Thanks in advance.
>
> populateItem() method of AbstractColumn :
>
> public void populateItem(Item<ICellPopulator<Family>> cellitem,String
> cellid, IModel<Family> model){
>
>  final Family f = model.getObject();
>  String id=f.getFamilyId(); //what to display this is an anchor
>
> Link alink = new Link(cellid) {
>  @Override
>   public void onClick() {
>       setResponsePage(new SubFamiliesPage(f));
>   }
> };
> cellitem.add(alink);
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>