Skip to main content

api.getColumn(id)

Description

Gets an object with the column configuration

Usage

api.getColumn(id): object;

Parameters

  • id - the id of a column

Returns

The method returns an object with the column parameters:

{
id: string,
width: number,
flexgrow?: number,
sort?: boolean,
left?: number,
editor?: string | any,
setter?: (obj: {}, value: Value) => void,
getter?: (obj: {}) => Value,
hidden?: boolean,
options?: [],
header?: string | [],
footer?: string | [],
resize?: boolean,
treetoggle?: boolean,
cell?: any,
css?: string,
tooltip?: boolean | (obj: any) => any
}

Example

The example below shows how to output the "city" column configuration to the console:

<script>
import { getData } from "./common/data";
import { Grid } from "@wx/svelte-grid";

const { data, columns } = getData();

let api;

$: if (api) {
const column = api.getColumn("city");
console.log("Column:", column);
}
</script>

<Grid {data} {columns} bind:api />

Related articles: