-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all
I am creating a listbox programatically:
final Combobox combo = new Combobox(); combo.setReadonly(true); combo.setConstraint("no empty"); List<Dict> dict =factory.getAllDicts(); ListModel dictModel = new BindingListSubModelList(dict, true); combo.setVisible(true); Comboitem comboitem = new Comboitem(); ZKCompUtil.createDataBindingAnnotation(comboitem,"self", "each=e",null,false); ZKCompUtil.createDataBindingAnnotation(comboitem,"label","e.getLabel",null,false); ZKCompUtil.createDataBindingAnnotation(comboitem,"value","e.getId",null,false); combo.appendChild(comboitem); combo.setModel(dictModel); combo.setItemRenderer(new DictComboitemRenderer());
This code is invoked on listbox row, when it is being edited, and labels are changing to edit fields, some of them to comboboxes.
When the row is changing to edit state and my listbox is being shown there is no value selected. I am able to retrieve the underlying value and its index, but invoking setSelectedIndex on combobox results in ArrayIndexOfBoundsException. I think i should bind the data in some way, but don't know how.
Maybe you can provide some example.
I was thininking about changing to listbox (mold=select) but I was getting the same error.
Regards.
try to use this event to setselectedIndex for combo box:
public void onInitRenderLater$cbLine(Event evt) { try { ListModelList lml = (ListModelList) cbLine.getModel(); cbLine.setSelectedIndex(ZkossUtil.getLineIndex(lineId, lml)); } catch (Exception e) { } }
Asked: 2010-07-28 03:00:08 +0800
Seen: 321 times
Last updated: Jul 29 '10