🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

svelte-datatables-net

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-datatables-net

svelte-datatables-net is a svelte/sveltekit component that turns data into an interactive HTML table. Inspired by datatables.net.

1.0.1
Source
npm
Version published
Weekly downloads
325
52.58%
Maintainers
0
Weekly downloads
 
Created
Source

svelte-datatables-net

GITHUB VERSION NPM VERSION NPM Downloads NPM License Twitter

svelte-datatables-net is a svelte/sveltekit component that turns data into an interactive HTML table.

BOOTSTRAP EXAMPLE

VERSIONS

  • VERSION 1.0.0 OR ABOVE WORKS WITH SVELTE 5 ONLY (NEWER AND RECOMMENDED VERSIONS WITH IMPROVEMENTS!)
  • PREVIOUS VERSIONS WORKS WITH SVELTE 3, 4 AND 5.

FEATURES

  • POSSIBILITY OF CHOOSING THE SEARCHABLE COLUMNS.
  • POSSIBILITY OF CHOOSING THE SORTABLE COLUMNS.
  • PAGINATION.
  • POSSIBILITY OF CHOOSING AND CHANGING THE NUMBER OF ROWS PER PAGE.
  • NON-OPINIONATED STYLING.
  • NON-OPINIONATED POSITIONING.
  • TYPESCRIPT SUPPORT.

DEMOS

INSTALLATION

npm install svelte-datatables-net

COMPONENT STRUCTURE

  • functionCreateDatatable: A function to create an object with all the states of the component.
  • Datatable: Datatable element surrounding your table structure.
  • Search: A svelte component with a search input.
  • RowsPerPage: A svelte component with a select input to choose the number of rows per page.
  • Pagination: A svelte component to change the active page.
  • Sort: A svelte component that enable sorting for a specific column.
  • typeDatatable: If you are using typescript, it is a type definition for the component states.

PARAMETERS AND PROPS

  • PARAMETERS OF functionCreateDatatable:
PARAMETERDESCRIPTIONTYPEREQUIREDDEFAULT
parDataAN ARRAY WITH THE DATA.Generic[]YES-
parSearchableColumnsAN ARRAY WITH THE SEARCHABLE COLUMNS (KEYS OF parData).(keyof Generic)[]NOundefined
parSearchStringTHE SEARCH STRING CAN BE SET PREVIOUSLY WITH THIS PROP.stringNO'' (EMPTY STRING)
parRowsPerPageTHE INITIAL NUMBER OF ROWS PER PAGE.string (NUMERIC STRING OR 'all')NO'all'
parSortByTHE INITIAL SORT COLUMN (A KEY OF parData).keyof GenericNOundefined (NO INITIAL SORTING)
parSortOrderTHE INITIAL SORT ORDER.'ascending' OR 'descending'NO'ascending'
parSortFunctionA COMPARE FUNCTION THAT SPECIFIES THE INITIAL SORT ORDER. (MORE DETAILS HERE)(a: Generic, b: Generic) => numberNOA STANDARD FUNCTION TO SORT ALPHABETICALLY.
  • PROPS OF Datatable:
PROPDESCRIPTIONTYPEREQUIREDDEFAULT
propDatatableA BINDABLE OBJECT WITH THE DATATABLE STATES (OBJECT CREATED WITH functionCreateDatatable)typeDatatable<Generic>YES-
  • PROPS OF Search:
PROPDESCRIPTIONTYPEREQUIREDDEFAULT
propPlaceholderSEARCH INPUT PLACEHOLDER.stringNO'Type here...'
classCSS CLASSES OF THE SEARCH INPUT.stringNO-
styleCSS STYLES OF THE SEARCH INPUT.stringNO-
  • PROPS OF Pagination:
PROPDESCRIPTIONTYPEREQUIREDDEFAULT
propTagHTML TAG OF THE PAGINATION ITEM.'span' OR 'div' OR 'li' OR 'button' OR 'a'YES-
propPreviousPREVIOUS BUTTON TEXT.stringNO-
propNextNEXT BUTTON TEXT.stringNO-
propComponentOPTIONAL COMPONENT TO USE INSIDE THE PAGINATION ITEM.stringNO-
styleCSS STYLES FOR PAGINATION ITEMS.stringNO-
classCSS CLASSES FOR PAGINATION ITEMS.stringNO-
propDisabledStyleCSS STYLES FOR DISABLED PAGINATION ITEMS.stringNO-
propDisabledClassCSS CLASSES FOR DISABLED PAGINATION ITEMS.stringNO-
propActiveStyleCSS STYLES FOR ACTIVE PAGINATION ITEMS.stringNO-
propActiveClassCSS CLASSES FOR ACTIVE PAGINATION ITEMS.stringNO-
  • PROPS OF RowsPerPage:
PROPDESCRIPTIONTYPEREQUIREDDEFAULT
classCSS CLASSES OF THE SELECT INPUT.stringNO-
styleCSS STYLES OF THE SELECT INPUT.stringNO-
  • PROPS OF Sort:
PROPDESCRIPTIONTYPEREQUIREDDEFAULT
propDatatableAN OBJECT WITH THE DATATABLE STATES (OBJECT CREATED WITH functionCreateDatatable)typeDatatable<Generic>YES-
propColumnCOLUMN TO SORT.keyof GenericYES-
propIconSizeSIZE OF THE SORT ICONnumberNO10
propSortFunctionA COMPARE FUNCTION THAT SPECIFIES THE SORT ORDER. (MORE DETAILS HERE)(a: Generic, b: Generic) => numberNOA STANDARD FUNCTION TO SORT ALPHABETICALLY.

EXAMPLES AND DEVELOPING

ONCE YOU'VE INSTALLED THE DEPENDENCIES WITH npm install, START A DEVELOPMENT SERVER TO RUN THE EXAMPLES IN THE routes FOLDER WITH npm run dev.

Keywords

datatable

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts