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 #
columnProperties #
• columnProperties: TableColumnConfig<Data>
An object with one key for each key in the data, containing configuration options for each table column
Defined in #
dataSource #
• dataSource: IDataSource<Data> | Readable<IDataSource<Data>>
The data source where the datatable requests the table data from
Defined in #
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 #
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 #
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 #
enableSearch #
• Optional enableSearch: boolean
Whether to show the search textbox
Defined in #
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 #
highlightedItemId #
• Optional highlightedItemId: string | Readable<undefined | string>
The identifier of any item which then gets assigned the highlighted class
Defined in #
itemsPerPage #
• Optional itemsPerPage: number
Maximum amount of rows shown on one page
Defined in #
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 #
messageFormatterPrefix #
• Optional messageFormatterPrefix: string
Prefix for every message id. Only applies to external message formatters such as the svelte-i18n formatter.
Defined in #
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 #
modalComponent #
• Optional modalComponent: SvelteComponentTyped<any, any, any>
A svelte component shown when a user clicks on a row to expand it
Defined in #
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 #
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 #
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 #
showTableHeader #
• Optional showTableHeader: boolean
Whether to show the table header row.
Tables without a header are not sortable!
Defined in #
showTopPagination #
• Optional showTopPagination: boolean
If the pagination component at the top of the datatable should be shown
Defined in #
type #
• type: string
A unique identifier/name for this datatable. Should not contain whitespaces and non-ascii characters