Skip to main content
Version: 26.2.0

getColumnSortInfo

getColumnSortInfo() retrieves the current sorting configuration for a specified column.

const { getColumnSortInfo } = viz;
getColumnSortInfo(columnName: string): ColumnSortInfo

Parameters:

PropertyTypeRequiredDescription
columnNamestringtrueThe name of the column to retrieve sort information for

Returns: ColumnSortInfo object containing sorting details

Throws: Error if the column does not exist in the current schema

ColumnSortInfo Type

The returned object contains the following properties:

interface ColumnSortInfo {
  customOrder?: string[];
  direction?: 'asc' | 'desc';
}
PropertyTypeDescription
customOrderstring[]Array defining custom sort order for categorical values
direction'asc' | 'desc' \Sort direction: 'asc' for ascending, 'desc' for descending

Basic Usage

// Retrieve sort information for a column
const sortInfo = muze.getColumnSortInfo('Sales');
//sortInfo.direction: asc

// Check if a column has a custom sort order
const regionSort = muze.getColumnSortInfo('Region');
//regionSort.customOrder: ['North', 'South', 'East', 'West']