From Documentation

(Difference between revisions)
Jump to: navigation, search
m (Example)
(Use Cases)
Line 89: Line 89:
| 3.6
| 3.6
| Smalltalk: Paging Sorting with a filter object
| Smalltalk: Paging Sorting with a filter object
| []
| [[Small_Talks/2009/May/Paging_Sorting_with_a_filter_object |Paging Sorting with a filter object]]
| 3.6
| 3.6

Revision as of 09:09, 14 December 2010




A paging component is used to separate long content into multiple pages. For example, assume that you have 100 items and prefer to show 20 items at a time, then you can use the paging components as follows.

The listbox and grid component support the paging intrinsically, so you don't need to specify a paging component explicitly as above, unless you want to have different visual layout or to control multiple listbox and grid with one paging component.


Paging mold default.png

     <paging totalSize="100" pageSize="20"/>

When a user clicks on the hyperlinks, the onPaging event is sent with an instance of org.zkoss.zul.event.PagingEvent to the paging component. To decide which portion of your 100 items are visible, you shall add a listener to the paging component.

	<paging id="paging" />
	List result = new SearchEngine().find("ZK");
	//assume SearchEngine.find() will return a list of items.
	paging.addEventListener("onPaging", new org.zkoss.zk.ui.event.EventListener() {
		public void onEvent(Event event) {
			int pgno = event.getPaginal().getActivePage();
			int ofs = pgno * event.getPaginal().getPageSize();
			new Viewer().redraw(result, ofs, ofs + event.getPaginal().
				getPageSize() - 1);
			//assume redraw(List result, int b, int e) will display
			//from the b-th item to the e-th item

Supported Events

Event Type
Event: PagingEvent

Notifies one of the pages of a multi-page component is selected by the user.

Supported Molds

Available molds of a component are defined in lang.xml embedded in zul.jar.

Paging mold default.png
Paging mold os.png

Supported Children


Use Cases

Version Description Example Location
3.6 Smalltalk: Paging Sorting with a filter object Paging Sorting with a filter object
3.6 Live Data,_Paging,_setModel_and_Implement_your_own_renderer

Version History

Last Update : 2010/12/14

Version Date Content

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.