0

Unsupported child for Listbox: <Listcell null>

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

darent gravatar image darent
1

updated 2023-04-24 22:47:37 +0800

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.

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

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

Seen: 3 times

Last updated: Apr 26 '23

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