Sheet row filter having multiple expected values

Posted by: vivek.reddyz on 7 July 2022, 9:12 am EST

  • Posted 7 July 2022, 9:12 am EST

    [b]```

    var spread = new GC.Spread.Sheets.Workbook(“ss”);

    var activeSheet = spread.getActiveSheet();

    activeSheet.setValue(0, 0, “North”);

    activeSheet.setValue(1, 0, “South”);

    activeSheet.setValue(2, 0, “East”);

    activeSheet.setValue(3, 0, “South”);

    activeSheet.setValue(4, 0, “North”);

    activeSheet.setValue(5, 0, “North”);

    activeSheet.setValue(6, 0, “West”);

    activeSheet.setColumnWidth(0, 80);

    // Set a row Filter

    activeSheet.rowFilter(new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(0, 0, 7, 1)));

    // Filter column 1 by “North”

    var rowFilter = spread.getActiveSheet().rowFilter();

    var condition = new GC.Spread.Sheets.ConditionalFormatting.Condition(

    GC.Spread.Sheets.ConditionalFormatting.ConditionType.textCondition, {

    compareType: GC.Spread.Sheets.ConditionalFormatting.TextCompareType.equalsTo,

    expected: “North”

    });

    rowFilter.addFilterItem(0, condition);

    rowFilter.filter(0);

    
    
    In this the expected value is 'North' , can we put more than 2 expected values like an array or something to get more than 2 expected values i.e both North and South
  • Posted 8 July 2022, 5:10 am EST

    Hi Vivek,

    The expected value doesn’t take array. You need to add another filter item and pass the condition to check for another text condition(say “South”).

    Please refer to the following sample: https://jscodemine.grapecity.com/share/rHCfK5WndUWUUmeLXVTHvw/

    Please let us know if you need further assistance on this. We would be happy to help you.

    Regards

    Ankit

Need extra support?

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

Learn More

Forum Channels