SpreadJS製品ヘルプ
updateCalcItem メソッド
GC.Spread.Pivot 名前空間 > PivotTable タイプ : updateCalcItem メソッド
sourceField名の名前
sourceFieldの名前calcItemname
このcalcItemの新しい数式。
このcalcItemの新しい優先度。
シンタックス
var instance = new GC.Spread.Pivot.PivotTable(name, sheet, row, col, layout, style);
instance.updateCalcItem(sourceName, calcItemName, formula, priority);
function updateCalcItem( 
   sourceName : string,
   calcItemName : string,
   formula : string,
   priority : number
) : void;

パラメータ

sourceName
sourceField名の名前
calcItemName
sourceFieldの名前calcItemname
formula
このcalcItemの新しい数式。
priority
このcalcItemの新しい優先度。
使用例
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
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};
sheet.pivotTables.add("pivotTable_1", 'sourceData', 1, 1, layout, theme, options);
var pivotTable = sheet.pivotTables.get("pivotTable_1");
pivotTable.add("Buyer","Buyer",GC.Spread.Pivot.PivotTableFieldType.rowField);
pivotTable.add("Type","Type",GC.Spread.Pivot.PivotTableFieldType.columnField);
pivotTable.add("Amount","Sum of Amount",GC.Spread.Pivot.PivotTableFieldType.valueField, GC.Pivot.SubtotalType.sum);
pivotTable.addCalcItem("Buyer", "formula1", "=Buyer[Mom]+Buyer[Dad]");
pivotTable.updateCalcItem("Buyer", "formula1", "=Buyer[Mom]+Buyer[Kelly]", 1);
関連トピック

参照

PivotTable タイプ