-
Bug
-
Resolution: Invalid
-
Normal
-
None
-
5.0.9
-
ZK Version 5.0.9 (independent of used browser)
A performance issue occurs when using a listbox with a huge set of data, no matter if used with or without paging. Normally one should think, that the paging mechanism has to prevent the component from generating things that are dependend on the size of the data model. In the listbox component this is not true, because whenever we are creating a listbox with a listmodel, the initialization leads to a generation of listitems in the size of the model. So, if we have 50000 objects in our model, the listbox will contain 50000 listitems. The matter of paging is just visible on the client-side, but not on the server-side. All listitems are pre-generated and on the paging event visualized and possibly attached with a model object.
The following code should illustrate the performance issue when starting with different model sizes.
(I noticed, that the real performance issue only exists when using on my server, with ZK Demo or ZK Fiddle the problem is not noticeable)
<zk> <window title="listboxtest" border="normal"> <zscript> <![CDATA[ import org.zkoss.zul.ListModel; import org.zkoss.zul.event.ListDataListener; ListModel model = new ListModel() { public void addListDataListener(ListDataListener arg0) { // TODO Auto-generated method stub } public Object getElementAt(int arg0) { // TODO Auto-generated method stub return null; } public int getSize() { // TODO Auto-generated method stub return 500000; } public void removeListDataListener(ListDataListener arg0) { // TODO Auto-generated method stub } }; ]]> </zscript> <listbox id="lb" mold="paging" model="${model}" pageSize="10"> </listbox> </window> </zk>