Filter Data in a Range"

From Documentation
Line 16: Line 16:
  
 
===Clear filter===
 
===Clear filter===
Use <javadoc directory="zss" method="showAllData()">org.zkoss.zss.model.Range</javadoc> to clear current filter
+
Use <javadoc directory="zss" method="showAllData()">org.zkoss.zss.model.Range</javadoc> to clear current filter.
  
 
===ZUML===
 
===ZUML===
 +
<source lang="xml">
 +
<zk>
 +
<div height="100%" width="100%" apply="org.zkoss.zssessentials.config.AutoFilterComposer">
 +
Criteria: hide "222"
 +
<div>
 +
<button id="autoFilter" label="Toggle AutoFilter" mold="trendy"></button>
 +
<button id="reapplyAutoFilter" label="Reapply AutoFilter" mold="trendy"></button>
 +
<button id="clearAutoFilter" label="Clear AutoFilter" mold="trendy"></button>
 +
</div>
 +
<spreadsheet id="spreadsheet" src="/WEB-INF/excel/config/autoFilter.xlsx"
 +
maxrows="200"
 +
maxcolumns="40"
 +
width="100%"
 +
height="450px"></spreadsheet>
 +
</div>
 +
</zk>
 +
</source>
 +
===Composer===
 +
====Reapply AutoFilter====
 +
<source lang="java" high="7,8,9,10">
 +
int rowIndex;
 +
int columnIndex;
 +
Spreadsheet spreadsheet;
 +
 +
public void onClick$reapplyAutoFilter() {
 +
Ranges.range(spreadsheet.getSelectedSheet(), rowIndex, columnIndex).applyFilter();
 +
}
 +
</source>
 +
The Criteria is hide "222"
 +
[[File:ZKSsEss_Spreadsheet_AutoFilter.png]] </br>
 +
Input "222" in A4, and click Reapply AutoFilter button
 +
[[File:ZKSsEss_Spreadsheet_AutoFilter_Reapply.png]] </br>
 +
 +
====Clear AutoFilter====
  
===Composer===
 
  
 
=Version History=
 
=Version History=

Revision as of 11:07, 20 May 2011


Available in ZK Spreadsheet EE only

ZK Spreadsheet can filter data to find a subset of data in a range.

Purpose

Filtered data display rows that meet criteria, and hide trivial data.

AutoFilter

Use Range.autoFilter() can toggle AutoFilter for sheet in a range. After applied AutoFilter, user can specify criteria use Range.autoFilter(integer, object, integer, object, boolean) to filter data in a range.

Reapply filter

If data within AutoFilter range has been added, modified or deleted. Reapply a filter can display different results using same criteria. Use Range.applyFilter() to reapply current filter.

Clear filter

Use Range.showAllData() to clear current filter.

ZUML

<zk>
<div height="100%" width="100%" apply="org.zkoss.zssessentials.config.AutoFilterComposer">
	Criteria: hide "222"
	<div>
		<button id="autoFilter" label="Toggle AutoFilter" mold="trendy"></button>
		<button id="reapplyAutoFilter" label="Reapply AutoFilter" mold="trendy"></button>
		<button id="clearAutoFilter" label="Clear AutoFilter" mold="trendy"></button>
	</div>
	<spreadsheet id="spreadsheet" src="/WEB-INF/excel/config/autoFilter.xlsx"	
				maxrows="200" 
				maxcolumns="40"
				width="100%"
				height="450px"></spreadsheet>
</div>
</zk>

Composer

Reapply AutoFilter

int rowIndex;
int columnIndex;
Spreadsheet spreadsheet;

public void onClick$reapplyAutoFilter() {
	Ranges.range(spreadsheet.getSelectedSheet(), rowIndex, columnIndex).applyFilter();
}

The Criteria is hide "222" File:ZKSsEss Spreadsheet AutoFilter.png
Input "222" in A4, and click Reapply AutoFilter button File:ZKSsEss Spreadsheet AutoFilter Reapply.png

Clear AutoFilter

Version History

Last Update : 2011/05/20


Version Date Content
2.1.0 May, 2011 AutoFilter
     


All source code listed in this book is at Github.


Last Update : 2011/05/20

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