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/02/09 09:16:59 UTC

DataTable : Write direct HTML in cells?

Greetings all,

I want to write direct HTML content in  DataTable cells.
Something like like :

public abstract class AbstractWidthChangableColumn<E> extends 
AbstractColumn<E>{
  public void populateItem(Item<ICellPopulator<E>> cellitem,
            String id, IModel<E> model)
   {
    ..
    ..
    ..
    String htmlSnippet="<a href='somehere'>somehere</a>";
    cellitem.writeSomeHTML(htmlSnippet);
   }
}

where 'htmlSnippet' is dynamic ?

Any tips?

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


Re: DataTable : Write direct HTML in cells?

Posted by Igor Vaynberg <ig...@gmail.com>.
use a label, call setoutputmodelstrings(false) on it

-igor

On Tue, Feb 9, 2010 at 12:16 AM, Ashika Umanga Umagiliya
<au...@biggjapan.com> wrote:
> Greetings all,
>
> I want to write direct HTML content in  DataTable cells.
> Something like like :
>
> public abstract class AbstractWidthChangableColumn<E> extends
> AbstractColumn<E>{
>  public void populateItem(Item<ICellPopulator<E>> cellitem,
>           String id, IModel<E> model)
>  {
>   ..
>   ..
>   ..
>   String htmlSnippet="<a href='somehere'>somehere</a>";
>   cellitem.writeSomeHTML(htmlSnippet);
>  }
> }
>
> where 'htmlSnippet' is dynamic ?
>
> Any tips?
>
> ---------------------------------------------------------------------
> 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


Re: DataTable : Write direct HTML in cells?

Posted by Ashika Umanga Umagiliya <au...@biggjapan.com>.
Thanks Igor ,Ernesto !

That helped alot!
Ernesto Reinaldo Barreiro wrote:
> Use a Label? E.g.
>
> @Override
>             public void populateItem(Item<ICellPopulator<Broker>> item,
> String componentId, IModel<Broker> rowModel)
>             {
>                 Label label =new Label(componentId, new
> AbstractReadOnlyModel<String>() {
>
>                     private static final long serialVersionUID = 1L;
>
>                     @Override
>                     public String getObject() {
>                         return "Generate your HTML";
>                     }
>                 });
>                 label.setEscapeModelStrings(false);
>                 item.add(label);
>             }
>
> Ernesto
>
> On Tue, Feb 9, 2010 at 9:16 AM, Ashika Umanga Umagiliya <
> aumanga@biggjapan.com> wrote:
>
>   
>> Greetings all,
>>
>> I want to write direct HTML content in  DataTable cells.
>> Something like like :
>>
>> public abstract class AbstractWidthChangableColumn<E> extends
>> AbstractColumn<E>{
>>  public void populateItem(Item<ICellPopulator<E>> cellitem,
>>           String id, IModel<E> model)
>>  {
>>   ..
>>   ..
>>   ..
>>   String htmlSnippet="<a href='somehere'>somehere</a>";
>>   cellitem.writeSomeHTML(htmlSnippet);
>>  }
>> }
>>
>> where 'htmlSnippet' is dynamic ?
>>
>> Any tips?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>   


Re: DataTable : Write direct HTML in cells?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Use a Label? E.g.

@Override
            public void populateItem(Item<ICellPopulator<Broker>> item,
String componentId, IModel<Broker> rowModel)
            {
                Label label =new Label(componentId, new
AbstractReadOnlyModel<String>() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public String getObject() {
                        return "Generate your HTML";
                    }
                });
                label.setEscapeModelStrings(false);
                item.add(label);
            }

Ernesto

On Tue, Feb 9, 2010 at 9:16 AM, Ashika Umanga Umagiliya <
aumanga@biggjapan.com> wrote:

> Greetings all,
>
> I want to write direct HTML content in  DataTable cells.
> Something like like :
>
> public abstract class AbstractWidthChangableColumn<E> extends
> AbstractColumn<E>{
>  public void populateItem(Item<ICellPopulator<E>> cellitem,
>           String id, IModel<E> model)
>  {
>   ..
>   ..
>   ..
>   String htmlSnippet="<a href='somehere'>somehere</a>";
>   cellitem.writeSomeHTML(htmlSnippet);
>  }
> }
>
> where 'htmlSnippet' is dynamic ?
>
> Any tips?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>