📄 sorting.zul
字号:
<?xml version="1.0" encoding="UTF-8"?><!--sorting.zul{{IS_NOTE Purpose: Description: History: Mon Nov 17 16:13:25 2008, Created by jumperchen}}IS_NOTECopyright (C) 2008 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><window id="demo" apply="org.zkoss.zkdemo.userguide.DemoWindowComposer">
<html><![CDATA[
<h4>Grid (Sorting and Menu)</h4>
<p>Grid allows the <i>Menupopup</i> component to be added as its column-menu, supporting <i>grouping</i>, <i>sorting</i>, and <i>hiding</i>.</p>
]]></html>
<separator/>
<tabbox width="100%" tabscroll="false">
<tabs>
<tab id="demoView" label="Demo"/>
<tab id="srcView" label="View Source"/>
</tabs>
<tabpanels>
<tabpanel>
<window id="view">
</window>
</tabpanel>
<tabpanel>
<panel>
<panelchildren>
<textbox id="codeView" class="code" rows="20" width="95%">
<attribute name="value"><![CDATA[
<zk>
<!-- Due to the security constraint, ZK demo site doesn't allow
zscript to declare a class. Instead we use a pre-compiled Java class.
You can uncomment the following and try it in your local server.
<zscript>
class Comp implements Comparator {
private boolean _asc;
public Comp(boolean asc) {
_asc = asc;
}
public int compare(Object o1, Object o2) {
String s1 = o1.getChildren().get(0).getValue(),
s2 = o2.getChildren().get(0).getValue();
int v = s1.compareTo(s2);
return _asc ? v: -v;
}
}
Comp asc = new Comp(true), dsc = new Comp(false);
</zscript>
-->
<zscript>
import org.zkoss.zkdemo.userguide.*;
Comparator asc = new RowLabelComparator(true),
dsc = new RowLabelComparator(false);
</zscript>
<grid>
<columns menupopup="auto">
<column label="Author" sortAscending="${asc}" sortDescending="${dsc}"/>
<column label="Title"/>
<column label="Publisher"/>
<column label="Hardcover"/>
</columns>
<rows>
<row>
<label value="Philip Hensher"/>
<label value="The Northern Clemency"/>
<label value="Knopf (October 30, 2008)"/>
<label value="608 pages"/>
</row>
<row>
<label value="Philip Hensher"/>
<label value="The Fit"/>
<label value="HarperPerennial (April 4, 2005)"/>
<label value="240 pages"/>
</row>
<row>
<label value="Philip Hensher"/>
<label value="Kitchen Venom"/>
<label value="Flamingo (May 19, 2003)"/>
<label value="336 pages"/>
</row>
<row>
<label value="Michael Greenberg"/>
<label value="Hurry Down Sunshine"/>
<label value="Other Press (September 9, 2008)"/>
<label value="240 pages"/>
</row>
<row>
<label value="Michael Greenberg"/>
<label value="Painless Vocabulary (Painless)"/>
<label value="Barron's Educational Series (September 1, 2001)"/>
<label value="292 pages"/>
</row>
<row>
<label value="Rick Perlstein"/>
<label value="Nixonland: The Rise of a President and the Fracturing of America"/>
<label value="Scribner; 1st Scribner Hardcover Ed edition (May 13, 2008)"/>
<label value="896 pages"/>
</row>
<row>
<label value="Rick Perlstein"/>
<label value="Nixonland"/>
<label value="Simon & Schuster (May 13, 2008)"/>
<label value="0 pages"/>
</row>
</rows>
</grid>
</zk>
]]></attribute>
</textbox>
</panelchildren>
<toolbar mold="panel">
<button id="tryBtn" label="Try me!"/>
<button id="reloadBtn" label="Reload" height="18px"/>
</toolbar>
</panel>
</tabpanel>
</tabpanels>
</tabbox>
</window>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -