SpreadJS 13
GC.Spread.Sheets.ConditionalFormatting Namespace / ConditionRuleBase type / stopIfTrue Method
Whether rules with lower priority are applied before this rule.
In This Topic
    stopIfTrue Method
    In This Topic
    Gets or sets whether rules with lower priority are applied before this rule.
    Syntax
    var instance = new GC.Spread.Sheets.ConditionalFormatting.ConditionRuleBase(ruleType, style, ranges);
    var returnValue; // Type: any
    returnValue = instance.stopIfTrue(value);
    function stopIfTrue( 
       value : boolean
    ) : any;

    Parameters

    value
    Whether rules with lower priority are applied before this rule.

    Return Value

    If no value is set, returns whether the rules with lower priority are not applied before this rule; otherwise, returns the condition rule.
    Example
    This example applies multiple rules.
    activeSheet.setArray(0,0,[1,2,3,4,5,6,7,8,9,10]);
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "red";
    style.foreColor = "black";
    var cell = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
    cell.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.cellValueRule);
    cell.operator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.greaterThan);
    cell.value1(5);
    cell.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
    cell.style(style);
    activeSheet.conditionalFormats.addRule(cell);
    
    var style1 = new GC.Spread.Sheets.Style();
    style1.foreColor = "red";
    var top = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
    top.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.top10Rule);
    top.type(GC.Spread.Sheets.ConditionalFormatting.Top10ConditionType.top);
    top.rank(3);
    top.style(style1);
    top.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
    top.stopIfTrue(true);
    activeSheet.conditionalFormats.addRule(top);
    Remarks
    The stopIfTrue method applies the first rule in precedence that is True and ignores rules lower in precedence if they are True. When two rules conflict, the rule with higher precedence is applied. If two rules do not conflict (one rule uses a bold font and the other rule uses a cell backcolor), then both rules are applied.
    See Also