You can do this when you create select model. For example, in my
application I have a drop down of catagories fetched by a DAO, with
first element being "-- Please Select":
@Cached
public SelectModel getCategoriesModel() {
Schemed schema = _catalog.computeOdsSchema();
WebDaoParameter param = new WebDaoParameter();
param.setMode(PagingMode.NoPaging);
param.setSchemed(schema);
final List categories =
_promosDao.getCategories(param).get();
return new SelectModel() {
private final SelectModel __model;
{
int modelSize = categories.size() + 1;
OptionModel[] options = new
OptionModel[modelSize];
String blankLabel = "-- Please Select";
options[0] = new OptionModelImpl(blankLabel, 0);
int index = 1;
for (NodeBean category : categories) {
String label =
category.getDescription();
int value = category.getId();
options[index++] = new
OptionModelImpl(label, value);
}
__model = new SelectModelImpl(options);
}
public List getOptionGroups() {
return __model.getOptionGroups();
}
public List getOptions() {
return __model.getOptions();
}
public void visit(SelectModelVisitor aVisitor) {
__model.visit(aVisitor);
}
};
}
Then, in your TML reference this model as attribute value of your
select component.
On Thu, May 8, 2008 at 8:38 AM, Leon Derks <[EMAIL PROTECTED]> wrote:
> Hello
>
> Is it possible to overwrite the first element in a select box?
> At the moment this is an empty value, but can I for example overwrite this
> with "All"
>
> Leon
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]