Move Range - Drag Edit"
From Documentation
Line 15: | Line 15: | ||
3. Release mouse to perform drag edit<br/> | 3. Release mouse to perform drag edit<br/> | ||
[[File:ZKSsEss_Spreadsheet_DragEdit_DragEdit.png]]<br/> | [[File:ZKSsEss_Spreadsheet_DragEdit_DragEdit.png]]<br/> | ||
− | |||
− | |||
Line 35: | Line 33: | ||
</source> | </source> | ||
− | ===Current Range=== | + | ===Composer=== |
+ | |||
+ | ====Current Range==== | ||
We can get user's selection range from onCellSelection event | We can get user's selection range from onCellSelection event | ||
Line 47: | Line 47: | ||
</source> | </source> | ||
[[File:ZKSsEss_Spreadsheet_DragEdit_MoveRange.png]] | [[File:ZKSsEss_Spreadsheet_DragEdit_MoveRange.png]] | ||
− | ===Move Range=== | + | ====Move Range==== |
<source lang="java" high="8"> | <source lang="java" high="8"> | ||
Intbox moveRows; | Intbox moveRows; |
Revision as of 05:05, 2 December 2010
Purpose
ZK Spreadsheet support drag edit, to move cell's value.
Drag Edit
Drag edit range is base on Range.move(integer, Integer).
1. Select a range
2. Mouse over the border, mouse cursor will change to cross, drag the selection to new position
3. Release mouse to perform drag edit
ZUML
<zk>
<div height="100%" width="100%" apply="org.zkoss.zssessentials.config.MoveRangeComposer">
<div height="3px"></div>
Row: <intbox id="moveRows" value="0"/>, Col: <intbox id="moveCols" value="0"/>
<button id="moveBtn" label="Move Current Selection" mold="trendy"></button>
<spreadsheet id="spreadsheet" src="/WEB-INF/excel/config/demo_sample.xls"
maxrows="200"
maxcolumns="40"
width="100%"
height="450px"></spreadsheet>
</div>
</zk>
Composer
Current Range
We can get user's selection range from onCellSelection event
Spreadsheet spreadsheet;
Range currentRange;
public void onCellSelection$spreadsheet(CellSelectionEvent event) {
currentRange = Ranges.range(event.getSheet(), event.getTop(), event.getLeft(),
event.getBottom(), event.getRight());
}
Move Range
Intbox moveRows;
Intbox moveCols;
Button moveBtn;
public void onClick$moveBtn() {
Integer row = moveRows.getValue();
Integer col = moveCols.getValue();
if (currentRange != null && row != null && col != null) {
currentRange.move(row, col);
currentRange = null;
}
}
View complete source of ZUML moveRange.zul
View complete source of composer MoveRangeComposer.java
Version History
Version | Date | Content |
---|---|---|
All source code listed in this book is at Github.