Revision history [back]

click to hide/show revision 1
initial version

asked 2023-04-24 22:44:40 +0800

darent gravatar image darent

Unsupported child for Listbox: <listcell null="">

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++, "Daniel", "Arencibia", 27));
    prestacionesList.add(new Prestaciones(id++, "Raúl", "Arencibia", 23));
    prestacionesList.add(new Prestaciones(id++, "Yasmina", "El Abid", 24));
    prestacionesList.add(new Prestaciones(id++, "Marta", "Torralbo", 60));
    prestacionesList.add(new Prestaciones(id++, "Braulio", "Arencibia", 60));
    prestacionesList.add(new Prestaciones(id++, "Cronos", "Border Collie", 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.

Unsupported child for Listbox: <listcell null="">

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++, "Daniel", "Arencibia", "First", "Uno", 27));
    prestacionesList.add(new Prestaciones(id++, "Raúl", "Arencibia", "Second", "Dos", 23));
    prestacionesList.add(new Prestaciones(id++, "Yasmina", "El Abid", "Third", "Tres", 24));
    prestacionesList.add(new Prestaciones(id++, "Marta", "Torralbo", "Fourth", "Cuatro", 60));
    prestacionesList.add(new Prestaciones(id++, "Braulio", "Arencibia", "Fifth", "Cinco", 60));
    prestacionesList.add(new Prestaciones(id++, "Cronos", "Border Collie", "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.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More