Spread ASP.NET 16
Spread for ASP.NET 16 Product Documentation / Developer's Guide / Customizing User Interaction / Managing Filtering of Rows of User Data / Customizing Simple Filtering of Rows of User Data / Using Row Filtering
In This Topic
    Using Row Filtering
    In This Topic

    This topic summarizes how the end user can interact with the simple row filtering feature.

    Once you have row filtering applied to a column, an indicator appears in the column header as in the following figure:

    Row Filter Indicator in Header

    If you want to display a label for the header, you must add another row of column headers and put the label in that row.

    The column header displays the row filtering indicator, a drop-down arrow symbol. Clicking on this indicator provides a drop-down list of the filter choices. Picking an item from this list causes that filter to be applied and all the rows meeting that condition (in this column) are filtered. The default drop-down list contains all the unique text values in cells in this column. The figure below shows an example of a drop-down list of filters:

    Row Filter Drop-Down List

    The table below summarizes the entries in the drop-down list.

    Filter List Item Description
    (All) Include or allow all the rows in this column regardless of content
    [contents] Include or allow only those rows with this particular cell content in this column
    (Blanks) Include or allow only rows that have blanks (empty cells) in this column
    (NonBlanks) Include or allow only rows that have non-blanks (non-empty cells) in this column, in other words any cell that has any content

    You can customize the filter list. For more information, see Customizing the List of Filter Items.

    Using Code

    Create a named style and then set the style row filter.

    Example

    This example code sets a style row filter.

    C#
    Copy Code
    FpSpread1.ActiveSheetView.AutoFilterMode = FarPoint.Web.Spread.AutoFilterMode.FilterGadget;

    FarPoint.Web.Spread.NamedStyle instyle = new FarPoint.Web.Spread.NamedStyle();
    FarPoint.Web.Spread.NamedStyle outstyle = new FarPoint.Web.Spread.NamedStyle();
    instyle.BackColor = Color.Yellow;
    outstyle.BackColor = Color.Aquamarine;
    FarPoint.Web.Spread.FilterColumnDefinition fcd = new FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences | FarPoint.Web.Spread.FilterListBehavior.Default);
    FarPoint.Web.Spread.FilterColumnDefinition fcd1 = new FarPoint.Web.Spread.FilterColumnDefinition(2);
    FarPoint.Web.Spread.FilterColumnDefinition fcd2 = new FarPoint.Web.Spread.FilterColumnDefinition();
    FarPoint.Web.Spread.StyleRowFilter sf = new FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets[0], instyle, outstyle);
    sf.AddColumn(fcd);
    sf.AddColumn(fcd1);
    sf.AddColumn(fcd2);
    FpSpread1.Sheets[0].RowFilter = sf;
    VB
    Copy Code
    FpSpread1.ActiveSheetView.AutoFilterMode = FarPoint.Web.Spread.AutoFilterMode.FilterGadget

    Dim instyle As New FarPoint.Web.Spread.NamedStyle()
    Dim outstyle As New FarPoint.Web.Spread.NamedStyle()
    instyle.BackColor = Color.Yellow
    outstyle.BackColor = Color.Aquamarine
    Dim fcd As New FarPoint.Web.Spread.FilterColumnDefinition(1, FarPoint.Web.Spread.FilterListBehavior.SortByMostOccurrences Or FarPoint.Web.Spread.FilterListBehavior.Default)
    Dim fcd1 As New FarPoint.Web.Spread.FilterColumnDefinition(2)
    Dim fcd2 As New FarPoint.Web.Spread.FilterColumnDefinition()
    Dim sf As New FarPoint.Web.Spread.StyleRowFilter(FpSpread1.Sheets(0), instyle, outstyle)
    sf.AddColumn(fcd)
    sf.AddColumn(fcd1)
    sf.AddColumn(fcd2)
    FpSpread1.Sheets(0).RowFilter = sf
    See Also