0

ZK 5.0.1-FL-2010-02-12 Listbox live data creating nodes for all the rows

asked 2010-02-18 17:17:19 +0800

kesavkolla gravatar image kesavkolla
180 3

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>

And the FakeModel code is:
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?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-02-19 11:09:44 +0800

richardbounds gravatar image richardbounds
12

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... ;-)

link publish delete flag offensive edit

answered 2010-02-19 15:31:04 +0800

kesavkolla gravatar image kesavkolla
180 3

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

link publish delete flag offensive edit
Your reply
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: 2010-02-18 17:17:19 +0800

Seen: 341 times

Last updated: Feb 19 '10

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