How to AddTextFilter to spread JS sheet in V10

Posted by: rajkumar.n1 on 9 April 2019, 4:21 pm EST

  • Posted 9 April 2019, 4:21 pm EST

    Hi,

    We have created Text filter to hide Invisible rows by using the below code

    var rowFilter = activeSheet.rowFilter();
    rowFilter.addTextFilter(0, GcSpread.Sheets.ComparisonOperator.EqualsTo, "Visible");
    rowFilter.filter(0);
    rowFilter.reFilter();


    How can we achieve this in V10 in Grapecity Spread JS
  • Replied 11 April 2019, 7:48 pm EST

    From spread.sheets version 10+, we set a filter using the addFilterItem() method. Please refer to the following code snippet:
    var activeSheet = spread.getActiveSheet();
    var condition = new GC.Spread.Sheets.ConditionalFormatting.Condition(GC.Spread.Sheets.ConditionalFormatting.ConditionType.textCondition, {
    compareType: GC.Spread.Sheets.ConditionalFormatting.TextCompareType.equalsTo,
    expected: "Visible"
    });
    var rowFilter = activeSheet.rowFilter();
    if(!rowFilter){
    rowFilter = new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(0, 0, 7, 3));
    activeSheet.rowFilter(rowFilter);
    }
    rowFilter.addFilterItem(1, condition);
    rowFilter.filter(1);


    You may also refer to the following sample:
    https://www.grapecity.com/en/demos/spread/JS/TutorialSample/#/demos/basicFilter

    Regards
Need extra support?

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

Learn More

Forum Channels