How to check whether any filters are applied to grid or not ?

Posted by: hariharan.ramachandran on 5 January 2020, 8:43 pm EST

  • Posted 5 January 2020, 8:43 pm EST

    We are using FarPoint for Windows Version 11.45.20181.0

    I recently tried to use AutoFilter feature and used EnhancedContextMenu feature.
    grd.ActiveSheet.AutoFilter = true;
    foreach (FarPoint.Win.Spread.Column col in grd.ActiveSheet.Columns)
    {
    col.AllowAutoFilter = true;
    }
    grd.ActiveSheet.AutoFilterMode = AutoFilterMode.EnhancedContextMenu;


    Now how to check whether any filter is applied to grid or not and also how to get the list of filters applied (Column wise).

    I appreciate your help.
  • Marked as Answer

    Replied 6 January 2020, 7:23 pm EST

    Hello,

    You can use the AutoFilteredColumn event that fires as soon as a column gets filtered. Inside the event handler, you may get the filter by the following code snippet:
    int colIndex = e.Column;
    string filterString = fpSpread1.ActiveSheet.RowFilter.GetColumnFilterBy(colIndex);
    var filterRows =fpSpread1.ActiveSheet.RowFilter.GetIntersectedFilteredInRows();
    Also, if at any moment you want to check whether the grid is filtered, you may either use the
    fpSpread1.ActiveSheet.RowFilter.GetFilteredOutRowList().Count>0
    condition or check the filter column wise through
    fpSpread1.ActiveSheet.RowFilter.IsFiltered(columnIndex);
    Best wishes,
    Ruchir
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels