0

Scrolling two listboxes together

asked 2010-05-06 15:34:40 +0800

rappr gravatar image rappr
48

hi

I have two listboxes directly next to each other.
Both contain data that is longer than the page. So they got scrollbars.
Since the data belongs together line by line I want to scroll both listboxes at the same time if the user scrolls one of them.
Is this possible?

Thanks. Ralf

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2010-05-09 21:30:23 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi rappr
In ZK5 you can control in client side

<zk xmlns:w="http://www.zkoss.org/2005/zk/client">
	<window title="Livedata Demo" border="normal">
		<zscript><![CDATA[	
			String[] data = new String[30];
			for (int j = 0; j < data.length; ++j) {
				data = "option " + j;
			}
			ListModel strset = new SimpleListModel(data);
		]]></zscript>
		<hbox>
			<listbox width="200px" rows="10" model="${strset}">
				<attribute w:name="_doScroll"><![CDATA[
					function () { 
						this.$_doScroll();
						this.nextSibling.ebody.scrollTop = this._currentTop;
					}
				]]></attribute>
				<listhead>
					<listheader label="Load on demend" />
				</listhead>
			</listbox>
			<listbox width="200px" rows="10" model="${strset}">
				<attribute w:name="_doScroll"><![CDATA[
					function () { 
						this.$_doScroll();
						this.previousSibling.ebody.scrollTop = this._currentTop;
					}
				]]></attribute>
				<listhead>
					<listheader label="Load on demend 2" />
				</listhead>
			</listbox>
		</hbox>
	</window>
</zk>

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-05-06 15:34:40 +0800

Seen: 416 times

Last updated: May 09 '10

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