Spread Windows Forms 7.0 Product Documentation
Allowing the User to Filter Rows
See Also Support Options
Spread Windows Forms 7.0 Product Documentation > Developer's Guide > Customizing Row or Column Interaction > Managing Filtering of Rows of User Data > Allowing the User to Filter Rows

Glossary Item Box

By default, the spreadsheet does not allow the user to filter the rows of a spreadsheet. You can turn on this feature and allow row filtering to all or specific columns on a sheet. Hidden rows are not displayed even if they match the filter criteria.

Use the HideRowFilter class or StyleRowFilter class depending on whether you want to hide rows that are filtered or change the style of those rows. Use the Column.AllowAutoFilter property to turn on filtering for a given column.

Use the AutoFilterMode property to specify the type of filtering. You can specify the simple filter style (FilterGadget), the enhanced filter style (EnhancedContextMenu), or the enhanced filter style with filter bar (FilterBar).

The user can then click the items in the drop-down to filter the rows. To understand how the filtering works for the end user, refer to Understanding Simple Row Filtering.

To understand the other aspects of filtering that can be customized, return to the overview at Managing Filtering of Rows of User Data.

Using Code

Allow row filtering (hiding rows that are filtered out) based on values in one column. Make sure the column headers are visible. (Refer to Showing or Hiding Headers.)

Select the type of row filtering, using the HideRowFilter class, then allow that filtering for a specified column, using the AllowAutoFilter property. This example assumes that you have some data in the cells, either by assigning values or binding to a data source.


C# Copy Code
fpSpread1.ActiveSheet.ColumnHeaderVisible = true;
FarPoint.Win.Spread.HideRowFilter hideRowFilter = new FarPoint.Win.Spread.HideRowFilter(fpSpread1.ActiveSheet);
fpSpread1.ActiveSheet.Columns[1,3].AllowAutoFilter = true;
fpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.FilterGadget;
VB Copy Code
FpSpread1.ActiveSheet.ColumnHeaderVisible = True
Dim hideRowFilter As New FarPoint.Win.Spread.HideRowFilter(FpSpread1.ActiveSheet)
FpSpread1.ActiveSheet.Columns(1, 3).AllowAutoFilter = True
FpSpread1.ActiveSheet.AutoFilterMode = FarPoint.Win.Spread.AutoFilterMode.FilterGadget

Using the Spread Designer

  1. Select a column by clicking on the column header.
  2. Set AllowAutoFilter under the Misc. section of the Property window.
  3. Use the File menu, then Apply and Exit to save the changes.

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.