-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, I'm just trying to bind some datas from my Implements class: public class PrestacionesDAOImpl implements PrestacionesDAO{
private List<Prestaciones> prestacionesList= new LinkedList<Prestaciones>();
private int id = 1;
public PrestacionesDAOImpl() {
prestacionesList.add(new Prestaciones(id++, "First", "Uno", 27));
prestacionesList.add(new Prestaciones(id++, "Second", "Dos", 23));
prestacionesList.add(new Prestaciones(id++, "Third", "Tres", 24));
prestacionesList.add(new Prestaciones(id++, "Fourth", "Cuatro", 60));
prestacionesList.add(new Prestaciones(id++, "Fifth", "Cinco", 60));
prestacionesList.add(new Prestaciones(id++, "Sixth", "Seis", 2));
}
Into my index.zul, in a listbox: <zk> <window title="Principal" border="normal" apply="com.springzk.pruebazk.controller.IndexController">
<hbox align="center">
<textbox id="keywordBox"/>
<button id="searchButton" label="Buscar"/>
</hbox>
<listbox id="prestListbox" emptyMessage="No se ha encontrado nigún registro" rows="10">
<listhead>
<listheader label="Nombre"/>
<listheader label="Apellidos"/>
<listheader label="Edad"/>
</listhead>
<template name="model">
<listcell label="${each.nombre}"></listcell>
<listcell label="${each.apellidos}"></listcell>
<listcell label="${each.edad}"></listcell>
</template>
</listbox>
</window> </zk>
with my IndexController:
public class IndexController extends SelectorComposer<component>{
private static final long serialVersionUID = 1L;
@Wire
private Textbox keywordBox;
@Wire
private Listbox prestListbox;
private ListModelList<Prestaciones> list = new ListModelList<>();
private PrestacionesDAO dao = new PrestacionesDAOImpl();
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
@Listen("onClick = #searchButton; onOK = window")
public void search() {
String keyword = keywordBox.getValue();
List<Prestaciones> result = dao.search(keyword);
prestListbox.setModel(new ListModelList<Prestaciones>(result));
/*list.clear();
list.addAll(dao.search(keyword));*/
System.out.println("\nSe han encontrado: " + result.size() + " registros.");
}
}
But when i search for a data, I get a "org.zkoss.zk.ui.UiException: Unsupported child for Listbox: <listcell null="">", and I don't know why..
Someone can help me? thank you so much.
Asked: 2023-04-24 22:44:40 +0800
Seen: 3 times
Last updated: Apr 26
wrong valueException come in front of modal popup [closed]
Use parameters in a conditional @command
Problems with multiple press and onCtrlKey
MVVM @save on the fly [closed]
Unable to activate destroyed desktop
org.zkoss.zk.ui.UiException: java.lang.ClassNotFoundException
How to put a image or Letter over image on a specific XY Coordinate