Paging"
Jimmyshiau (talk | contribs) (→Paging) |
Jimmyshiau (talk | contribs) |
||
Line 50: | Line 50: | ||
</zk> | </zk> | ||
</source> | </source> | ||
− | =Supported | + | =Supported Events= |
{| border="1" | width="100%" | {| border="1" | width="100%" | ||
Line 57: | Line 57: | ||
|- | |- | ||
| <center><tt>onPaging</tt></center> | | <center><tt>onPaging</tt></center> | ||
− | | <javadoc>org.zkoss. | + | | '''Event:''' <javadoc>org.zkoss.zul.event.PagingEvent</javadoc> |
− | + | Notifies one of the pages of a multi-page component is selected by the user. | |
|} | |} | ||
+ | |||
+ | *Inherited Supported Events: [[ZK_Component_Reference/Base_Components/XulElement#Supported_Events | XulElement]] | ||
=Supported molds= | =Supported molds= |
Revision as of 11:06, 25 November 2010
Paging
- Demonstration: Paging (with Grid), Paging (with Listbox), Paging (with Tree)
- Java API: Paging
- JavaScript API: Paging
- Style Guide: Paging
Employment/Purpose
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.
Example
<vbox>
<paging totalSize="100" pageSize="20"/>
</vbox>
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.
<zk>
<paging id="paging" />
<zscript>
List result = new SearchEngine().find("ZK");
//assume SearchEngine.find() will return a list of items.
paging.setTotalSize(result.size());
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
}
}
);
</zscript>
</zk>
Supported Events
Event: PagingEvent
Notifies one of the pages of a multi-page component is selected by the user. |
- Inherited Supported Events: XulElement
Supported molds
Available molds of a component are defined in lang.xml embedded in zul.jar.
Supported Children
*NONE
Use cases
Version | Description | Example Location |
---|---|---|
3.6 | Smalltalk: Paging Sorting with a filter object | http://docs.zkoss.org/wiki/Paging_Sorting_with_a_filter_object |
3.6 | Live Data | http://docs.zkoss.org/wiki/Live_Data,_Paging,_setModel_and_Implement_your_own_renderer |
Version History
Version | Date | Content |
---|---|---|