0

how to auto scroll listbox scrolling bottom

asked 2007-10-11 09:42:14 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4563404

By: yuzexu_zk

how to auto scroll listbox scrolling bottom

delete flag offensive retag edit

13 Replies

Sort by ยป oldest newest

answered 2007-10-11 10:01:01 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4563430

By: alexdusty

I've a similar problem (at least I suppose): I'm dinamically adding rows to a grid and when the visible part is full the scrollbar appears on the grid but I'm unable to programmatically show the last row. i.e.: I always see the first N rows and I have to scroll down manually to see the new ones added.
Is the problem solvable?

link publish delete flag offensive edit

answered 2009-09-08 12:47:04 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Is there a programmatic way to bring the last row in the grid visible?

Thanks.

link publish delete flag offensive edit

answered 2009-09-08 15:33:28 +0800

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

updated 2009-09-08 15:48:57 +0800

you can try
index.zul

<window border="normal" apply="ctrl.MyCtrl">
	<grid height="50px">
		<rows id="rows" />
	</grid>
	<button label="add" id="addBtn" />
</window>


MyCtrl.java
package ctrl;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.*;

public class MyCtrl extends GenericForwardComposer {

	private Rows rows;
	private static int count=0;
	@Override
	public void doAfterCompose(Component comp) throws Exception {
		// TODO Auto-generated method stub
		super.doAfterCompose(comp);
	}
	
	public void onClick$addBtn(){	
		count++;
		Row row =new Row();
		row.appendChild(new Label("new"+count));
		row.setParent(rows);
		Clients.scrollIntoView(row);		
	}
}



//jimmy

link publish delete flag offensive edit

answered 2009-09-09 06:02:36 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Thank you, Jimmy. It works great! :)

link publish delete flag offensive edit

answered 2011-07-07 10:28:02 +0800

felice gravatar image felice
24 1

Grazie 1000 jimmy

your post was be very useful to me too!

fds

link publish delete flag offensive edit

answered 2012-01-05 17:47:03 +0800

francisco gravatar image francisco
6

It was very useful for me too!

I'm using the Clients.scrollIntoView to scroll into a div because I am developing a AJAX chat.

Thanks

link publish delete flag offensive edit

answered 2012-01-10 15:24:08 +0800

felice gravatar image felice
24 1

Ciao Jimmy,

Clients.scrollIntoView() seems does not work properly with Google Chrome (my test is with version 16.0.912.75 m).

My VBOX does not scroll down after that a new item was added.


Instead on Firefox,Opera and Explorer everything's gone ok.

Any suggestion is appreciated!

thanks

fds

link publish delete flag offensive edit

answered 2012-01-11 02:26:05 +0800

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

Hi fds,
can you post your sample?

link publish delete flag offensive edit

answered 2012-01-11 17:21:57 +0800

felice gravatar image felice
24 1

Ciao Jimmy,
... I want to thank you for your disponibility... but maybe I found the solution ... I have read in forum that with zk ver 5.0.4 has been introduced the "vlayout" element ... maybe it's the solution. I currently use a vbox with zk ver 5.0.1

grazie
fds

link publish delete flag offensive edit

answered 2012-02-14 17:06:27 +0800

felice gravatar image felice
24 1

Ciao Jimmy,

during activity porting from zk ver 5.0.1 to zk ver 5.0.10
I had to intervene on all layout element (window etc) because they have changed shape and size.

why? I've done something wrong?
how can i avoid this extra-effort?

grazie
fds

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: 2007-10-11 09:42:14 +0800

Seen: 2,201 times

Last updated: Mar 27 '12

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