-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am using ZK 5.0.1-FL-2010-02-12 and the sample listbox live demo.
<?page title="Test" contentType="text/html;charset=UTF-8"?> <zk> <zscript> ListModel strset = new com.bodyfs.ui.FakeListModel(10000); </zscript> <listbox id="list" width="200px" rows="10" model="${strset}"> <listhead> <listheader label="Load on Demend" sort="auto" /> </listhead> </listbox> </zk>
package com.bodyfs.ui; import java.util.Comparator; import org.zkoss.zul.AbstractListModel; import org.zkoss.zul.ListModelExt; import org.zkoss.zul.event.ListDataEvent; public class FakeListModel extends AbstractListModel implements ListModelExt { private static final long serialVersionUID = 4143517731003447818L; private int _size; private boolean _asc = true; public FakeListModel() { this(10000); } public FakeListModel(int size) { _size = size; } // ListModelExt @SuppressWarnings("unchecked") public void sort(Comparator cmpr, boolean asc) { // System.out.println("==================SORT DATA================"); _asc = asc; invalidate(); } public void invalidate() { fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1); } // AbstractListModel public Object getElementAt(int v) { String value = "Option " + (_asc ? v : _size - v - 1); // System.out.println(value); return value; } // AbstractListModel public int getSize() { return _size; } // AbstractListModel public void setSize(int size) { _size = size; } }
When I run the Test.zul it is creating all the <tr> nodes for the 20000 with hidden data. It's taking browser to crash with this amount of data.
Is there any way to control the behavior to just create nodes of only required legnth?
I've just run into a similar problem. I guess it is because Render-on-Demand has been reserved for the "Enterprise Edition":
http://docs.zkoss.org/wiki/Performance_Tip#Render_on_Demand_to_Show_Huge_Data_with_Grid_and_Listbox
Making your basic product perform like crap seems like a strange way to sell the commercial version... ;-)
I thought it's the behavior of the live data and is part of the LGPL version. I guess the demo examples they give on the website are very much misleading. I was impressed by many features that were in the demo and picked up this product. After I slowly started using for my project now I am realizing not all the features are in LGPL version. Now I have to see which features are in which version of the product. The listbox live data is very serious limitation
Asked: 2010-02-18 17:17:19 +0800
Seen: 341 times
Last updated: Feb 19 '10