Hide Row and Column Titles"

From Documentation
Line 28: Line 28:
 
====Current Range====
 
====Current Range====
  
We can get user's selection range from onCellSelection event
+
We can get the user's selection range from onCellSelection event.
 
<source lang="java" high="3">
 
<source lang="java" high="3">
 
Range currentRange;
 
Range currentRange;

Revision as of 09:07, 30 August 2011


Purpose

ZK Spreadsheet can hide row or column using Range.setHidden(Boolean)

ZUML

<zk>
<div height="100%" width="100%" apply="demo.HideHeaderComposer">
	<menupopup id="headerMenupopup">
		<menuitem id="show" label="Show"/>
		<menuitem id="hide" label="Hide"/>
	</menupopup>
	<div height="3px"></div>
	<spreadsheet id="spreadsheet" src="/demo_sample.xls"	
			maxrows="200" 
			maxcolumns="40"
			width="100%"
			height="450px"></spreadsheet>
</div>
</zk>

Composer

Current Range

We can get the user's selection range from onCellSelection event.

Range currentRange;
public void onCellSelection$spreadsheet(CellSelectionEvent event) {
	currentRange = Ranges.range(event.getSheet(), event.getTop(), event.getLeft(), 
			event.getBottom(), event.getRight());
}

Open Header Menu

We can open menu when user right click on header using onHeaderRightClick

private Menupopup headerMenupopup;
public void onHeaderRightClick$spreadsheet(HeaderMouseEvent event) {
	headerMenupopup.open(event.getPageX(), event.getPageY());
}

ZKSsEss Spreadsheet HideTitle Menu.png

Hide Header

When user click hide will hide header in selected range.

private Menuitem hide;
public void onClick$hide() {
	if (currentRange != null) {
		currentRange.setHidden(true);
		currentRange = null;
	}
}

ZKSsEss Spreadsheet HideTitle Hide.png

Show Header

When user click show will show hidden header in selected range

private Menuitem show;
public void onClick$show() {
	if (currentRange != null) {
		currentRange.setHidden(false);
		currentRange = null;
	}
}

Select range that include hidden range
ZKSsEss Spreadsheet HideTitle HiddenRange.png

Show hidden range
ZKSsEss Spreadsheet HideTitle Show.png

hideTitle.zul HideHeaderComposer.java

Version History

Last Update : 2011/08/30


Version Date Content
     


All source code listed in this book is at Github.


Last Update : 2011/08/30

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