Spread Windows Forms 6.0 Product Documentation
Allowing the User to Filter Rows
Support Options
Spread Windows Forms 6.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.

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.

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 Using 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.

Example

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;
 
VB Copy Code
FpSpread1.ActiveSheet.ColumnHeaderVisible = True
 
Dim hideRowFilter As New FarPoint.Win.Spread.HideRowFilter(FpSpread1.ActiveSheet)
 
   
 
FpSpread1.ActiveSheet.Columns(1, 3).AllowAutoFilter = True
 

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.
© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.