svelte-advanced-datatable
TypeScript icon, indicating that this package has built-in type declarations

0.8.1 • Public • Published

Svelte Advanced DataTable

(Documentation is still WIP)

Features

  • Highly configurable datatable
  • Data pagination
  • Sorting, searching/filtering the data
  • Compatible with the sveltestrap (Bootstrap) component framework or your own UI styles by implementing a few components
  • Supports svelte-i18n or a custom i18n library
  • Data loaded using Fetch-API or the svelte-query library

Quick Links

Usage

Installing

# Install prerequisites such as TailwindCSS and DaisyUI
...

# Install the npm package
pnpm add -D svelte-advanced-datatable

Basic DataTable

After installing the svelte-advanced-datatable library, import the DataTable component from the package for your ui library.

To use the component, pass the config object with all required properties to it:

<script lang='ts'>
	import type { DataTableConfig } from 'svelte-advanced-datatable';
	import { ComponentType, FetchApiDataSource } from 'svelte-advanced-datatable';
	import { DataTable } from 'svelte-advanced-datatable/daisyUi';

	interface UserData {
		id: number;
		userName: string;
	}

	const config: DataTableConfig<UserData> = {
		type: 'userData',
		columnProperties: {
			id: {
				type: ComponentType.NUMBER
			},
			userName: {
				type: ComponentType.STRING
			}
		},
		dataUniquePropertyKey: 'id',
		messageConfig: {
			id: {
				label: 'Id'
			},
			userName: {
				label: 'Username'
			}
		}
	};
    
    const dataSource = new FetchApiDataSource('/api/users/list');
</script>

<DataTable {config} {dataSource} />

View the documentation for all supported config options and more examples

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.8.1142latest

Version History

VersionDownloads (Last 7 Days)Published
0.8.1142
0.8.00
0.7.00
0.6.31
0.6.20
0.6.10
0.6.00
0.5.30
0.4.30
0.4.20
0.4.10
0.4.00
0.3.30
0.3.20
0.3.10
0.3.00
0.2.60
0.2.50
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i svelte-advanced-datatable

Weekly Downloads

143

Version

0.8.1

License

MIT

Unpacked Size

121 kB

Total Files

140

Last publish

Collaborators

  • kage0x3b