Hi Bert,
Bert Heikamp wrote:
if (parent2 instanceof SimpleTable) {
Page page = ((SimpleTable)parent2).getPage();
PageImports pageImports = getPage().getPageImports();
pageImports.addImport(getControlField());
}
You could retrieve the parent page as follows:
Page page = ClickUtils.getParentPage(this);
getParentPage will recursively check for the parent Page up the
hierarchy. This call should always succeed in retrieving the Page.
Alternatively you could look at using a Decorator instead of
overriding render, as that will provide you a callback mechanism to
set the field value to some default:
final FieldColumn column = new FieldColumn("time", field);
column.setDecorator(new Decorator() {
public String render(Object row, Context context) {
Field field = column.getField();
// If field is blank, set default value
if (StringUtils.isBlank(field.getValueObject())) {
field.setValue("12:00");
}
return field.toString();
}
});
Will this work in your scenario?
kind regards
bob