SpreadJS Documentation
addTop10Rule Method
GC.Spread.Sheets.ConditionalFormatting Namespace > ConditionalFormats type : addTop10Rule Method
The top 10 condition.
The number of top or bottom items to apply the style to.
The style that is applied to the cell when the condition is met.
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.
Adds the top 10 rule or bottom 10 rule to the collection based on the Top10CondtionType object.
Syntax
var instance = new GC.Spread.Sheets.ConditionalFormatting.ConditionalFormats(worksheet);
var value; // Type: object
value = instance.addTop10Rule(type, rank, style, ranges);
function addTop10Rule( 
   type : Top10ConditionType,
   rank : number,
   style : Style,
   ranges : undefined
) : object;

Parameters

type
The top 10 condition.
rank
The number of top or bottom items to apply the style to.
style
The style that is applied to the cell when the condition is met.
ranges
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.

Return Value

The top 10 rule added to the rule collection.
Example
This example uses the addTop10Rule method.
var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
var ranges=[new GC.Spread.Sheets.Range(0,0,10,1)];
activeSheet.conditionalFormats.addTop10Rule(GC.Spread.Sheets.ConditionalFormatting.Top10ConditionType.top, 2, style, ranges);
activeSheet.setValue(0, 0, 1);
activeSheet.setValue(1, 0, 50);
activeSheet.setValue(2, 0, 11);
activeSheet.setValue(3, 0, 5);
See Also

Reference

ConditionalFormats type