I think you can use an AbstractReadOnlyModel like:
getObject{
return testObj.getCname()+testObj.getId();
}

On Tue, Nov 10, 2009 at 4:02 PM, Swarnim Ranjitkar <swarn...@hotmail.com>wrote:

>
>  I have a ListView with a requirement that I display one one the column as
> combination of two fields eg. my cnameID should be cname:id.
>  Is there a way to get the model so that it is Label is combination of two
> fields or do I have to create a wrapper object for this purpose.
>
>  ListView = new ListView("test", testList) {
>  @Override
>  protected void populateItem(ListItem item) {
>    TestObject testObj = (TestObj) item.getModelObject();
>        item.add(new Label("Name", new PropertyModel(testObj, "name")));
>        //second column should be cname:id
>           item.add(new Label("cnameID", new PropertyModel(testObj,
> "cname")));
>
>  public class TestObj{
>  public String name;
>  public int id;
>  public String cname;
>  }
>  thank you




-- 
Pedro Henrique Oliveira dos Santos

Reply via email to