Custom Filter in Far Point Grid

Posted by: kamlesh on 8 September 2017, 3:10 pm EST

  • Posted 8 September 2017, 3:10 pm EST

    I am using Farpoint Version 5.0.3514.2008.  I want to apply filter on data rows. I had already derived a class from

    FarPoint.Win.Spread.BaseFilterItem

    Want to apply some filtering on page load itself.Don't want to show the filter list in column header.

    fpSpread1.ActiveSheet.Columns[1].AllowAutoFilter = true
    My filter expression can be based on multiple columns. i.e  I have three columns in grid Name,Age,Dept   then my expression could be "name != '' and Age>10"

    Some thing like this

     


  • Replied 8 September 2017, 3:10 pm EST

               
    Hello,
     
    After applying filtering, you need to set ShowFilterIndicator property of the RowFilter to false in order to hide filter list in column header.
     
                fpSpread1.ActiveSheet.Columns[3].AllowAutoFilter = true;
                fpSpread1.ActiveSheet.AutoFilterColumn(3, "14.00", 3);
                fpSpread1.ActiveSheet.RowFilter.ShowFilterIndicator = false;
     
    Hope it helps. 
     
    Thanks,
    Reeva 
  • Replied 8 September 2017, 3:10 pm EST

    So this will work where my column value is 14. If want  not equal to 14 rest of the values displayed.What will be the expression

    just like "Not Equal To 14" or <>14.  what will be the syntax.

  • Replied 8 September 2017, 3:10 pm EST

    You need to create a custom filter  and use that in code. Code for the same is given below:-

            FpSpread1.Sheets(0).Cells(0, 1).Value = 30
            FpSpread1.Sheets(0).Cells(1, 1).Value = 15
            FpSpread1.Sheets(0).Cells(2, 1).Value = 100
            Dim customfilter As New FarPoint.Win.Spread.CustomFilterItem(New FarPoint.Win.Spread.FilterCondition(FarPoint.Win.Spread.CustomFilterOperatorType.NotEqual, 100), Nothing, True)
            Dim rowFilter As New FarPoint.Win.Spread.HideRowFilter(FpSpread1.ActiveSheet)
            Dim fd As New FarPoint.Win.Spread.FilterColumnDefinition(1, FarPoint.Win.Spread.FilterListBehavior.Custom)
            fd.Filters.Add(customfilter)
            rowFilter.ColumnDefinitions.Add(fd)
            FpSpread1.ActiveSheet.RowFilter = rowFilter
            FpSpread1.ActiveSheet.AutoFilterColumn(1, customfilter.DisplayName, 0)

     

    Else create a completely custom filter as shown in attached sample. 

    Hope it helps.

    Thanks,

    Reeva


    2013/08/CustomFilterNotEqualToValue.zip
Need extra support?

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

Learn More

Forum Channels