@univerjs-pro/sheets-pivot v0.5.0-beta.1Docs


Class: FPivotTable

Constructors

new FPivotTable()

new FPivotTable(
   unitId, 
   subUnitId, 
   pivotTableId, 
   injector): FPivotTable

Parameters

ParameterType
unitIdstring
subUnitIdstring
pivotTableIdstring
injectorInjector

Returns

FPivotTable

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:13

Properties

PropertyTypeDefined in
pivotTableIdstringpackages/sheets-pivot/src/facade/f-pivot-table.ts:10
subUnitIdstringpackages/sheets-pivot/src/facade/f-pivot-table.ts:9
unitIdstringpackages/sheets-pivot/src/facade/f-pivot-table.ts:8

Methods

addField()

addField(
   dataFieldIdOrIndex, 
   fieldArea, 
index): Promise<boolean>

Parameters

ParameterTypeDescription
dataFieldIdOrIndexstring | numberThe data field id.
fieldAreaPivotTableFiledAreaEnumThe area of the field.
indexnumberThe index of the field in the target area.

Returns

Promise<boolean>

Whether the pivot field is added successfully.

Description

Add a pivot field to the pivot table.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:55


getConfig()

getConfig(): Nullable<IPivotTableConfig>

Returns

Nullable<IPivotTableConfig>

The pivot table config or undefined.

Description

Get the pivot table config by the pivot table id.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:29


remove()

remove(): Promise<boolean>

Returns

Promise<boolean>

Description

Remove a pivot table from the workbook by pivot table id

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:38


removeField()

removeField(fieldIds): Promise<boolean>

Parameters

ParameterTypeDescription
fieldIdsstring[]The deleted field ids.

Returns

Promise<boolean>

Whether the pivot field is removed successfully.

Description

Remove a pivot field from the pivot table

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:91


renameField()

renameField(fieldId, name): Promise<boolean>

Parameters

ParameterTypeDescription
fieldIdstringThe field id.
namestringThe new name of the field.

Returns

Promise<boolean>

Whether the pivot table field is renamed successfully.

Description

Rename the pivot table field.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:227


setLabelManualFilter()

setLabelManualFilter(
   tableFieldId, 
   items, 
isAll?): Promise<boolean>

Parameters

ParameterTypeDescription
tableFieldIdstringThe field id of the filter.
itemsstring[]The items of the filter.
isAll?boolean-

Returns

Promise<boolean>

Whether the pivot table filter is set successfully.

Description

Set the pivot table manual filter.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:204


setLabelSort()

setLabelSort(tableFieldId, info): Promise<boolean>

Parameters

ParameterTypeDescription
tableFieldIdstringThe field id of the sort.
infoIPivotTableSortInfoThe sort info.

Returns

Promise<boolean>

Whether the pivot table sort info is set successfully.

Description

Set the pivot table sort info.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:182


setSubtotalType()

setSubtotalType(fieldId, subtotalType): Promise<boolean>

Parameters

ParameterTypeDescription
fieldIdstringThe field id.
subtotalTypePivotSubtotalTypeEnumThe subtotal type of the field.

Returns

Promise<boolean>

Whether the pivot table subtotal type is set successfully.

Description

Set the pivot table subtotal type for value field, it only works for the value field.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:158


updateFieldPosition()

updateFieldPosition(
   fieldId, 
   area, 
index): Promise<boolean>

Parameters

ParameterTypeDescription
fieldIdstringThe moved field id.
areaPivotTableFiledAreaEnumThe target area of the field.
indexnumberThe target index of the field, if the index is bigger than the field count in the target area, the field will be moved to the last, if the index is smaller than 0, the field will be moved to the first.

Returns

Promise<boolean>

Whether the pivot field is moved successfully.

Description

Update the pivot table field position.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:113


updateValuePosition()

updateValuePosition(position, index): Promise<boolean>

Parameters

ParameterTypeDescription
positionPivotTableValuePositionEnumThe position of the value field.
indexnumberThe index of the value field.

Returns

Promise<boolean>

Whether the pivot value field is moved successfully.

Description

If there are multiple value fields in the pivot table, you can update the position of the value field, which only can be position in row or column.

Defined in

packages/sheets-pivot/src/facade/f-pivot-table.ts:136