API calls for the pivot table

Learn more about available API calls for the pivot table control.

addMemberSort

addMemberSort(sort: SortObject): Promise<void>

Applies sort to the specified field. If another field is already sorted, this method adds an additional sort without removing the existing ones.

Parameters

Parameter/TypeDescription
sortSortObjectContains sort configuration.

Example:

pivotTable.addMemberSort({
  fieldName: "Category",
  order: "desc"
})
.then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of addMemberFilter() is run after the operation is fully completed.

clearFilters

clearFilters(fieldName?: string): Promise<void>

Clears all filters or filters for the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringoptionalThe field’s name. If the fieldName is not specified, the method clears all filters.

Example:

pivotTable.clearFilters().then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of clearFilters() is run after the operation is fully completed.

clearMemberFilter

clearMemberFilter(fieldName: string): Promise<void>

Clears the member filter applied to the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringThe field’s name.

Example:

pivotTable.clearMemberFilter("Category").then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of clearMemberFilter() is run after the operation is fully completed.

clearMemberSort

clearMemberSort(fieldName?: string): Promise<void>

Clears the member sort applied to the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringThe field’s name. If the fieldName is not specified, the method clears all member sorts applied to the data.

Example:

pivotTable.clearMemberSort("Country").then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of clearMemberSort() is run after the operation is fully completed.

clearSort

clearSort(): Promise<void>

Clears all sort configurations applied to the data.

Example:

pivotTable.clearSort().then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of clearSort() is run after the operation is fully completed.

getCell

getCell(rowIdx: number, colIdx: number): GridCellObject

Gets the cell object at the specified row and column coordinates.

Parameters

Parameter/TypeDescription
rowIdxnumberThe index of the row.
colIdxnumberThe index of the column.

Example

pivotTable.getCell(1, 2);

Live example

Returns: GridCellObject, which contains information about the cell.

getFilters

getFilters(fieldName?: string): Promise<FilterObject[]>

Returns all filters or filters applied to the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringoptionalThe field’s name. If the fieldName is not specified, getFilters() returns all filters applied to the component.

Example:

pivotTable.getFilters().then((result) => {
  // Your functionality
});
Live example

Returns: Promise<FilterObject[]> — a Promise that resolves to the current filter configuration. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of getFilters() is run after the operation is fully completed.

getMemberFilter

getMemberFilter(fieldName: string): Promise<FilterObject>

Returns the member filter applied to the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringThe field’s name.

Example:

pivotTable.getMemberFilter("Category").then((result) => {
  // Your functionality
});
Live example

Returns: Promise<FilterObject> — a Promise that resolves to the current filter configuration. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of getMemberFilter() is run after the operation is fully completed.

getMemberSort

getMemberSort(fieldName: string): Promise<SortObject>

Returns the sort configuration applied to the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringThe field’s name.

Example:

pivotTable.getMemberSort("Country").then((result) => {
  // Your functionality
});
Live example

Returns: Promise<SortObject> — a Promise that resolves to the current filter configuration. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of getMemberSort() is run after the operation is fully completed.

getSelectedCells

getSelectedCells(): GridCellObject[]

Gets all currently selected cells.

Example:

pivotTable.getSelectedCells();

Live example

Returns: GridCellObject[]

getSort

getSort(): Promise<SortObject[]>

Returns all sort configurations applied to the data.

Example:

pivotTable.getSort().then((result) => {
  // Your functionality
});
Live example

Returns: Promise<SortObject[]> — a Promise that resolves to the current sort configurations. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of getSort() is run after the operation is fully completed.

hasFilter

hasFilter(fieldName?: string): Promise<boolean>

Indicates whether a filter is applied to any field or the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringoptionalThe field’s name. If the fieldName is not specified, hasFilter() indicates whether any filter is applied to the component.

Example:

pivotTable.hasFilter("Category").then((result) => {
  // Your functionality
});

Returns: Promise<boolean> - a Promise that resolves to true or false. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of hasFilter() is run after the operation is fully completed.

hasMemberSort

hasMemberSort(fieldName: string): Promise<boolean>

Indicates whether sorting by members is applied to the specified field.

Parameters

Parameter/TypeDescription
fieldNamestringThe field’s name.

Example:

pivotTable.hasMemberSort("Category").then((result) => {
  // Your functionality
});

Returns: Promise<boolean> — a Promise that resolves to true or false. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of hasMemberSort() is run after the operation is fully completed.

hasSort

hasSort(): Promise<boolean>

Indicates whether any data is sorted.

Example:

pivotTable.hasSort().then((result) => {
  // Your functionality
});

Returns: Promise<boolean> — a Promise that resolves to true or false. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of hasSort() is run after the operation is fully completed.

scrollToColumn

scrollToColumn(columnIndex: number)

Scrolls the grid to the specified column.

Parameters

Parameter/TypeDescription
columnIndexnumberThe index of the column to which the grid will be scrolled. Indexes start from 0.

Example:

pivotTable.scrollToColumn(5);

Live example

scrollToRow

scrollToRow(rowIndex: number)

Scrolls the grid to the specified row.

Parameters

Parameter/TypeDescription
rowIndexnumberThe index of the row to which the grid will be scrolled. Indexes start from 0.

Example:

pivotTable.scrollToRow(50);

Live example

setFilters

setFilters(filters: FilterObject[]): Promise<void>

Applies the specified filters.

Parameters

Parameter/TypeDescription
filtersFilterObject[]Contains filter configuration.

Example:

pivotTable.setFilters([
  {
    fieldName: "Category",
    exclude: ["Bikes", "Cars"]
  },
  {
    fieldName: "Country",
    include: ["Canada", "France", "Germany"]
  }
])
.then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of setFilters() is run after the operation is fully completed.

setMemberFilter

setMemberFilter(filter: FilterObject): Promise<void>

Sets the member filter for the field, replacing the current filter configuration.

Parameters

Parameter/TypeDescription
filterFilterObjectContains filter configuration.

If a member filter is already applied, it will be overwritten. For example, if the current filter includes only "Bikes" and you set a new include filter for "Cars", the field will then include only "Cars".

Example:

pivotTable.setMemberFilter({
  fieldName: "Category",
  exclude: ["Bikes", "Cars"]
})
.then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of setMemberFilter() is run after the operation is fully completed.

setMemberSort

setMemberSort(sort: SortObject): Promise<void>

Applies sort to the specified field. If another field is already sorted, this method replaces the existing sort with the new one.

Parameters

Parameter/TypeDescription
sortSortObjectContains sort configuration.

Example:

pvitTable.setMemberSort({
  fieldName: "Country",
  order: "desc"
})
.then(() => {
  // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of setMemberSort() is run after the operation is fully completed.

setSort

setSort(sort: SortObject[]): Promise<void>

Applies the specified sort configurations.

Parameters

Parameter/TypeDescription
sortSortObject[]Contains sort configurations.

Example:

pivotTable.setSort([
  {
    fieldName: "Category,
    order: "desc"s
  },
  {
    fieldName: "Country",
    order: "desc"
  }
])
.then(() => {
 // Your functionality
});
Live example

Returns: Promise<void> — a Promise that resolves to undefined. It is useful when working with server-side data sources to perform operations over the data asynchronously. The Promise ensures that code depending on the result of setSort() is run after the operation is fully completed.

See also