SpreadJS 14
GC.Spread.Sheets Namespace / PivotTableManager type / getRangePivotAreas Method
Indicates the sheet range.
In This Topic
    getRangePivotAreas Method
    In This Topic
    Syntax
    var instance = new GC.Spread.Sheets.PivotTableManager(sheet);
    var value; // Type: IPivotAreasCollection
    value = instance.getRangePivotAreas(range);
    function getRangePivotAreas( 
       range : Range
    ) : IPivotAreasCollection;

    Parameters

    range
    Indicates the sheet range.

    Return Value

    all pivot areas contains in range.
    Example
    var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
    var sourceSheet = spread.getSheet(0);
    var sheet = spread.getSheet(1);
    var sourceData = [["Date","Buyer","Type","Amount"],
                      ["01-Jan","Mom","Fuel",74],
                      ["15-Jan","Mom","Food",235],
                      ["17-Jan","Dad","Sports",20],
                      ["21-Jan","Kelly","Books",125]];
    sourceSheet.setArray(0, 0, sourceData );
    sourceSheet.tables.add('sourceData', 0, 0, 5, 4);
    var layout = GC.Spread.Pivot.PivotTableLayoutType.compact;
    var theme = GC.Spread.Pivot.PivotTableThemes.medium2;
    var myPivotTable = sheet.pivotTables.add("pivotTable_1", 'sourceData', 1, 1, layout, theme);
    myPivotTable.add("Buyer", "Buyer", GC.Spread.Pivot.PivotTableFieldType.rowField);
    myPivotTable.add("Type", "Type", GC.Spread.Pivot.PivotTableFieldType.columnField)
    myPivotTable.add("Amount", "Sum of Amount", GC.Spread.Pivot.PivotTableFieldType.valueField, GC.Pivot.SubtotalType.sum);
    var pivotAreas = sheet.pivotTables.getRangePivotAreas(new GC.Spread.Sheets.Range(3, 2, 2, 2))[myPivotTable.name()];
    var style = new GC.Spread.Sheets.Style();
    style.backColor = 'red';
    myPivotTable.setStyle(pivotAreas[0], style);
    See Also