@univerjs-pro/sheets-pivot v0.5.0-beta.1 • Docs
Class: FPivotTable
Constructors
new FPivotTable()
new FPivotTable(
unitId,
subUnitId,
pivotTableId,
injector): FPivotTable
Parameters
Parameter | Type |
---|---|
unitId | string |
subUnitId | string |
pivotTableId | string |
injector | Injector |
Returns
Defined in
packages/sheets-pivot/src/facade/f-pivot-table.ts:13
Properties
Property | Type | Defined in |
---|---|---|
pivotTableId | string | packages/sheets-pivot/src/facade/f-pivot-table.ts:10 |
subUnitId | string | packages/sheets-pivot/src/facade/f-pivot-table.ts:9 |
unitId | string | packages/sheets-pivot/src/facade/f-pivot-table.ts:8 |
Methods
addField()
addField(
dataFieldIdOrIndex,
fieldArea,
index): Promise<boolean>
Parameters
Parameter | Type | Description |
---|---|---|
dataFieldIdOrIndex | string | number | The data field id. |
fieldArea | PivotTableFiledAreaEnum | The area of the field. |
index | number | The 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
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
Parameter | Type | Description |
---|---|---|
fieldIds | string [] | 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
Parameter | Type | Description |
---|---|---|
fieldId | string | The field id. |
name | string | The 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
Parameter | Type | Description |
---|---|---|
tableFieldId | string | The field id of the filter. |
items | string [] | 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
Parameter | Type | Description |
---|---|---|
tableFieldId | string | The field id of the sort. |
info | IPivotTableSortInfo | The 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
Parameter | Type | Description |
---|---|---|
fieldId | string | The field id. |
subtotalType | PivotSubtotalTypeEnum | The 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
Parameter | Type | Description |
---|---|---|
fieldId | string | The moved field id. |
area | PivotTableFiledAreaEnum | The target area of the field. |
index | number | The 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
Parameter | Type | Description |
---|---|---|
position | PivotTableValuePositionEnum | The position of the value field. |
index | number | The 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