-
FEATURED COMPONENTS
First time here? Check out the FAQ!
My combobox shows only 10 result. How to I show all result with scroll.
My code like this:
private void drawCombo(){
private List<Comboitem> items = new ArrayList<Comboitem>();
// this List have a more data.
Combobox combobox = new Combobox();
ListModel locaListModel = new SimpleListModel(items);
combobox.setModel(locaListModel);
combobox.setItemRenderer(new ComboItemRenderer());
row.appendChild(combobox);
}
// Inner class
public class ComboItemRenderer implements ComboitemRenderer {
@Override
public void render(Comboitem item, Object value) throws Exception {
item.setLabel(((Comboitem)value).getLabel());
item.setValue(((Comboitem)value).getValue());
}
}
// I just configure
combobox.setAutocomplete(true); //doesn't work
Are there any other way?
http://www.zkoss.org/zkdemo/userguide/#f5 - in this section combobox working fine with more data
Yes, i just tried. but this doesn't work. I get that message "Combobox doesn't support multiple rows, 12". I configured setRows(12).
Hello, Thanks.
I have some confusion. How to implement ListSubModel. how use getSubModel(Object value, int nRows); What is this parameter (value).
Are there any complete source? http://www.zkoss.org/smalltalks/comboboxEnhancement this is not sufficient.
My source code follows:
//Class
public class CodingBlockUIHandler extends GenericForwardComposer implements ListSubModel{
}
// Inside Bind method
Combobox combobox = new Combobox();
ListModel locaListModel = getSubModel(combobox, -1)
combobox.setModel(locaListModel);
// My sub method
public ListModel getSubModel(Object value, int nRows) {
//final String idx = value == null ? "" : objectToString(value);
if (nRows < 0) {
nRows = 10;
}
final LinkedList data = new LinkedList();
for (int i = 0; i < getTempSIList().size(); i++) {
data.add(getTempSIList().get(i));
}
return new SimpleListModel(data);
}
This is shows only 10 results again.
Thank you.
After trace the code, you'll know why, and how to modify it.
You can download the zk5 source code first.
Search SimpleListModel.java,
look into getSubModel(Object value, int nRows)
And then grep getSubModel,
you'll see how Combobox.java call such method.
So, you have to implement your own model.
BTW, a good title can attract other's help. Your title didn't tell much.
Asked: 2010-01-28 01:53:29 +0800
Seen: 1,420 times
Last updated: Feb 02 '10