Filter Data in a Range

From Documentation

Stop.png This article is out of date, please refer to for more up to date information.

Available in ZK Spreadsheet EE only

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


The filtered data is displayed in rows that meet the provided criteria, and hide those trivial ones.


Use Range.autoFilter() to toggle AutoFilter for sheet in a range. After applying AutoFilter, users can specify criteria by calling Range.autoFilter(integer, object, integer, object, boolean) to filter data in a range.

ZKSsEss Spreadsheet FilterData AutoFilter.png
AutoFilter with Criteria
ZKSsEss Spreadsheet FilterData AutoFilter WithCriteria.png

Reapply filter

If the content within AutoFilter range has been added, modified or deleted, reapply the current filter can force the sheet to update the result per the current filter criteria. Use Range.applyFilter() to reapply the current filter.

Clear filter

Use Range.showAllData() to clear the current AutoFilter.


<div height="100%" width="100%" apply="org.zkoss.zssessentials.config.AutoFilterComposer">
	Criteria: hide "222"
		<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>
	<spreadsheet id="spreadsheet" src="/WEB-INF/excel/config/autoFilter.xlsx">


Toggle AutoFilter

Spreadsheet spreadsheet;
int rowIndex;
int columnIndex;
public void onClick$autoFilter() {
	AutoFilter autoFilter = Ranges.range(spreadsheet.getSelectedSheet(), rowIndex, columnIndex).autoFilter();
	alert(autoFilter == null ? "Clear AutoFilter" : "Applied AutoFilter");

Toggle AutoFilter off
ZKSsEss Spreadsheet FilterData Clear AutoFilter.png

Reapply AutoFilter

public void onClick$reapplyAutoFilter() {

Edit Cell A4 222 and reapply AutoFilter
ZKSsEss Spreadsheet FilterData Reapply Edit.png
ZKSsEss Spreadsheet FilterData Reapply.png

Clear AutoFilter

public void onClick$clearAutoFilter() {

ZKSsEss Spreadsheet FilterData ClearFilter.png

View the complete source of ZUML autoFill.zul

View the complete source of composer

Version History

Last Update : 2022/01/19

Version Date Content
2.1.0 May, 2011 AutoFilter

All source code listed in this book is at Github.

Last Update : 2022/01/19

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