Skip to content

How to clear ListBox? (ZK)

I have very simple question. I amazed, that couldn’t find answer. How can I make total clearing of ListBox (org.zkoss.zul.ListBox) in ZK Framework?


Code below clears the Listbox, but maybe causes problems, if a model is used :


Code below clears the selection :


Code below sets a new model, deletes the old one and all items. The Listbox will be empty if the model is empty


If you like to get a new set of Items, the last one should be the best.
If you have a List of them use :

lb.setModel(new ListModelList<>(myList));