Ah I see. In the end you are going to display a string n the cell, but if the string is null then it should display the default value. I guess the problem is because you are using the PropertyColumn which is a convienience implementation, and the property you are using doesn't display the right values.

I think you need to change to the AbstractColumn and then you can use the DefaultModel when you override populateItem().

void populateItem(final Item cellItem, final String componentId, final IModel rowModel) { IModel<String> auditModel = new DefaultModel<String>(new PropertyModel<String>(rowModel, "audit_train"), "undefined");
      cellItem.add(new Label(componentId, auditModel);
}

The PropertyModel does the same thing that the PropertyColumn did in getting the audit_train out of the rowModel, and if it is null the DefaultModel will display the word 'undefined'.


I just noticed getCssClass() doesn't get a rowModel so it sets the css class for every cell in the column but has no way to know which row the css class is for. So you will need to use the AttributeModifier to add the css class as Ernesto suggested.

Norman Elton wrote:
Thanks for both responses. I'm going to try them both. Two
clarification questions:

- In Ernesto's idea (override populateItem()), would the model still
be dynamic? That is, if the table is used in a form and the data
updated, would the table reflect the new change? My terminology may be
a little off here.

- In Jason's idea (create a wrapped model), the notion of "default" is
actually an audit train object, not just a string? This wouldn't be
the end of the world, since AuditTrain is just an interface and I
could provide an instance of an anonymous inner class. It would have
to return "undefined" for it's name property, etc.

Thanks again, I will tinker with them both today.

Norman

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



--
Jason Lea



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

Reply via email to