Freeze Rows and Columns"
From Documentation
m (→Purpose) |
m (correct highlight (via JWB)) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ZKSpreadsheetEssentialsPageHeader}} | {{ZKSpreadsheetEssentialsPageHeader}} | ||
+ | |||
+ | {{Deprecated|url=http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials}} | ||
+ | |||
__TOC__ | __TOC__ | ||
===Purpose=== | ===Purpose=== | ||
− | ZK Spreadsheet can freeze row or column | + | ZK Spreadsheet can freeze row or column using <javadoc directory="zss" method="setRowfreeze(java.lang.Integer)">org.zkoss.zss.ui.Spreadsheet</javadoc> or <javadoc directory="zss" method="setColumnfreeze(java.lang.Integer)">org.zkoss.zss.ui.Spreadsheet</javadoc>. |
===ZUML=== | ===ZUML=== | ||
− | <source lang="xml" | + | <source lang="xml" highlight="4,12,14,15,16,21,23,24,25"> |
<zk> | <zk> | ||
<div height="100%" width="100%" apply="demo.FreezeComposer"> | <div height="100%" width="100%" apply="demo.FreezeComposer"> | ||
Line 40: | Line 43: | ||
</source> | </source> | ||
− | ===Open | + | ===Composer=== |
− | <source lang="java" | + | ====Open Cell Menu==== |
+ | <source lang="java" highlight="4"> | ||
Spreadsheet spreadsheet; | Spreadsheet spreadsheet; | ||
Menupopup cellMenu; | Menupopup cellMenu; | ||
Line 50: | Line 54: | ||
[[File:ZKSsEss_Spreadsheet_FreeHeader_Row.png]] | [[File:ZKSsEss_Spreadsheet_FreeHeader_Row.png]] | ||
− | ===Freeze | + | ====Freeze Row / Column==== |
− | <source lang="java" | + | <source lang="java" highlight="3,8"> |
public void onFreezeRow(ForwardEvent event) { | public void onFreezeRow(ForwardEvent event) { | ||
int row = Integer.parseInt((String)event.getData()); | int row = Integer.parseInt((String)event.getData()); | ||
Line 65: | Line 69: | ||
[[File:ZKSsEss_Spreadsheet_FreezeHeader_Result.png]] | [[File:ZKSsEss_Spreadsheet_FreezeHeader_Result.png]] | ||
− | ===Unfreeze | + | ====Unfreeze Row /Column==== |
− | <source lang="java" | + | <source lang="java" highlight="3,8"> |
Menuitem unfreezeRows; | Menuitem unfreezeRows; | ||
public void onClick$unfreezeRows() { | public void onClick$unfreezeRows() { | ||
Line 79: | Line 83: | ||
[[File:ZKSsEss_Spreadsheet_FreezeHeader_Unfreeze.png]] | [[File:ZKSsEss_Spreadsheet_FreezeHeader_Unfreeze.png]] | ||
− | Unfreeze result | + | Unfreeze result<br/> |
[[File:ZKSsEss_Spreadsheet_FreezeHeader_UnfreezeResult.png]] | [[File:ZKSsEss_Spreadsheet_FreezeHeader_UnfreezeResult.png]] | ||
+ | |||
+ | View complete source of ZUML [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/WebContent/config/freeze.zul freeze.zul] | ||
+ | |||
+ | View complete source of composer [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/src/org/zkoss/zssessentials/config/FreezeComposer.java FreezeComposer.java] | ||
=Version History= | =Version History= |
Latest revision as of 12:55, 19 January 2022
This article is out of date, please refer to http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials for more up to date information.
Purpose
ZK Spreadsheet can freeze row or column using Spreadsheet.setRowfreeze(Integer) or Spreadsheet.setColumnfreeze(Integer).
ZUML
<zk>
<div height="100%" width="100%" apply="demo.FreezeComposer">
<div height="3px"></div>
<spreadsheet id="spreadsheet" src="/demo_sample.xls"
maxrows="200"
maxcolumns="40"
width="100%"
height="450px"></spreadsheet>
<menupopup id="cellMenu">
<menu label="Freeze Row">
<menupopup>
<menuitem id="unfreezeRows" label="Unfreeze all rows" />
<menuseparator />
<menuitem label="Freeze Row 1" forward="onFreezeRow(0)"/>
<menuitem label="Freeze Row 2" forward="onFreezeRow(1)"/>
<menuitem label="Freeze Row 3" forward="onFreezeRow(2)"/>
</menupopup>
</menu>
<menu label="Freeze Col">
<menupopup>
<menuitem id="unfreezeCols" label="Unfreeze all cols" />
<menuseparator />
<menuitem label="Freeze Col 1" forward="onFreezeCol(0)"/>
<menuitem label="Freeze Col 2" forward="onFreezeCol(1)"/>
<menuitem label="Freeze Col 3" forward="onFreezeCol(2)"/>
</menupopup>
</menu>
</menupopup>
</div>
</zk>
Composer
Open Cell Menu
Spreadsheet spreadsheet;
Menupopup cellMenu;
public void onCellRightClick$spreadsheet(CellMouseEvent event) {
cellMenu.open(event.getPageX(), event.getPageY());
}
Freeze Row / Column
public void onFreezeRow(ForwardEvent event) {
int row = Integer.parseInt((String)event.getData());
spreadsheet.setRowfreeze(row);
}
public void onFreezeCol(ForwardEvent event) {
int col = Integer.parseInt((String)event.getData());
spreadsheet.setColumnfreeze(col);
}
Unfreeze Row /Column
Menuitem unfreezeRows;
public void onClick$unfreezeRows() {
spreadsheet.setRowfreeze(-1);
}
Menuitem unfreezeCols;
public void onClick$unfreezeCols() {
spreadsheet.setColumnfreeze(-1);
}
View complete source of ZUML freeze.zul
View complete source of composer FreezeComposer.java
Version History
Version | Date | Content |
---|---|---|
All source code listed in this book is at Github.