SpreadJS 14
GC.Spread.Pivot Namespace / PivotTable type / dataPosition Method
Indicates the position which is in row or column area.
Indicates the order in field row or column list.
In This Topic
    dataPosition Method
    In This Topic
    Syntax
    var instance = new GC.Spread.Pivot.PivotTable(name, sheet, row, col, layout, style);
    var value; // Type: any
    value = instance.dataPosition(positionType, positionIndex);
    function dataPosition( 
       (optional) positionType : DataPosition,
       (optional) positionIndex : number
    ) : any;

    Parameters

    positionType
    Indicates the position which is in row or column area.
    positionIndex
    Indicates the order in field row or column list.

    Return Value

    return the data position info of pivot table or void
    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 options = {showRowHeader: true, showColumnHeader: true};
    var pivotTable = sheet.pivotTables.add("pivotTable_1", 'sourceData', 1, 1, layout, theme, options);
    pivotTable.dataPosition(1,0) //move values to row area and index is 0
    pivotTable.dataPosition();//{positionType:1,positionIndex:0}
    See Also

    Reference

    PivotTable type