Column Configuration

The columnProperties config contains options for each dataTable column:

import { ComponentType } from './ComponentType.js'; import { DataTableConfig } from './DataTableConfig.js';
const config: DataTableConfig<YourData> = {
	...additionalConfigOptions,
	columnProperties: {
		id: {
			type: ComponentType.NUMBER
		},
		userName: {
			type: ComponentType.STRING
		}
	}
};

Each column requires at least the type option to be set. The following values are valid types:

TypeDescription
ComponentType.NUMBERGeneral JavaScript number type for integers and decimal numbers
ComponentType.STRINGGeneral JavaScript string type
ComponentType.BOOLEANGeneral boolean type with support for unusual boolean-like values, for example string values representing a boolean
ComponentType.ENUMEnum type to display enum values fancier, translate them and have default/unknown value names.
ComponentType.DATEDate type supporting the normal JavaScript Date as well as a luxon DateTime
ComponentType.CUSTOMCustom type to render a table column with a custom svelte component

Column Type Properties #

Generic Properties #

Besides the type property, all component types have the following (optional) properties:

NameTypeDescriptionDefault value
sortablebooleanIf the values in this column can be sorted by clicking on the table header.
Should usually be turned off for columns using a custom component.
true
hiddenbooleanHides this table columnfalse