Interface: DataTableConfig<Data>

index.DataTableConfig

Type parameters #

Name
Data

Properties #

additionalMessageFormatter #

• Optional additionalMessageFormatter: MessageFormatter

A custom message formatter which can return a replacement or undefined to default to the message provided by the internal formatter/svelte-i18n

Defined in #

types/DataTableConfig.ts:74


columnProperties #

columnProperties: TableColumnConfig<Data>

An object with one key for each key in the data, containing configuration options for each table column

Defined in #

types/DataTableConfig.ts:40


dataSource #

dataSource: IDataSource<Data> | Readable<IDataSource<Data>>

The data source where the datatable requests the table data from

Defined in #

types/DataTableConfig.ts:45


dataUniquePropertyKey #

dataUniquePropertyKey: keyof Data & string

The key of your items unique identifier.

For example a user id or a counter value which increases by one for each item, as long as it's unique for each item

Defined in #

types/DataTableConfig.ts:52


defaultSort #

• Optional defaultSort: Object

Sort the table using the given key and direction by default

Type declaration #

Name Type
columnKey? keyof Data & string
direction? SortDirection

Defined in #

types/DataTableConfig.ts:100


enablePagination #

• Optional enablePagination: boolean

Whether to enable or disable pagination entirely.

Watch out that the server must send all table rows at once if this is disabled.

Defined in #

types/DataTableConfig.ts:107


enableSearch #

• Optional enableSearch: boolean

Whether to show the search textbox

Defined in #

types/DataTableConfig.ts:129


forcedSearchQuery #

• Optional forcedSearchQuery: Readable<Partial<Pick<PaginatedListRequest<Data>, “searchQuery” | “orderBy”>>>

A search query which overwrites any values by the users current search. Can be used to apply a forced filter to the whole datatable

Defined in #

types/DataTableConfig.ts:90


highlightedItemId #

• Optional highlightedItemId: string | Readable<undefined | string>

The identifier of any item which then gets assigned the highlighted class

Defined in #

types/DataTableConfig.ts:95


itemsPerPage #

• Optional itemsPerPage: number

Maximum amount of rows shown on one page

Defined in #

types/DataTableConfig.ts:124


messageConfig #

• Optional messageConfig: MessageConfig<Data>

An object containing all strings used by the datatable, such as table headers, titles of buttons and more.

Ignored if svelte-i18n is enabled by the messageFormatterType option

Defined in #

types/DataTableConfig.ts:69


messageFormatterPrefix #

• Optional messageFormatterPrefix: string

Prefix for every message id. Only applies to external message formatters such as the svelte-i18n formatter.

Defined in #

types/DataTableConfig.ts:62


messageFormatterType #

• Optional messageFormatterType: “config” | “svelte-i18n”

Whether to use the messageConfig or the svelte-i18n library to provide all strings used by the datatable

Defined in #

types/DataTableConfig.ts:57


modalComponent #

• Optional modalComponent: SvelteComponentTyped<any, any, any>

A svelte component shown when a user clicks on a row to expand it

Defined in #

types/DataTableConfig.ts:79


onItemClick #

• Optional onItemClick: (item: Data) => void

Type declaration #

▸ (item): void

An onClick handler for a table row. Gets passed the data item which the clicked row displays

Parameters #
Name Type
item Data
Returns #

void

Defined in #

types/DataTableConfig.ts:85


searchParser #

• Optional searchParser: ISearchParser<string, string>

Which search parser to use to parse the users search text into search filters, categories and more

Defined in #

types/DataTableConfig.ts:134


showBottomPagination #

• Optional showBottomPagination: boolean

If the pagination component at the bottom of the datatable should be shown.

Notice that the bottom pagination is always hidden when less than 10 rows are shown

Defined in #

types/DataTableConfig.ts:119


showTableHeader #

• Optional showTableHeader: boolean

Whether to show the table header row.

Tables without a header are not sortable!

Defined in #

types/DataTableConfig.ts:141


showTopPagination #

• Optional showTopPagination: boolean

If the pagination component at the top of the datatable should be shown

Defined in #

types/DataTableConfig.ts:112


type #

type: string

A unique identifier/name for this datatable. Should not contain whitespaces and non-ascii characters

Defined in #

types/DataTableConfig.ts:35