2.0.0 • Published 4 years ago

data-table-light v2.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

data-table-light.js

light weight bootstrap styling js plugin for tables

Initialization

Plugin needs bootstrap style by default or you may use your own. No need jQuery or other libraries. CSS file just need for responsive option

npm install data-table-light

OR

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="dist/data-table-light.min.css">

<script type="text/javascript" src="dist/data-table-light.min.js"></script>

Basic usage

<div class="wrap">
   <table id="test_table"></table>
</div>
const mockData = [
	{
		text: 'Lorem ipsum dolor sit amet, consectetur',
		price: 15
	},
	{
		text: 'Consequuntur soluta nihil tenetur nulla',
		price: 25
	},
	{
		text: 'Laborum a neque',
		price: 35
	}
]

new DataTableLight({
	tableId: '#test_table',
	tHead: ['#','text', 'price'],
	index: true,
    data: mockData
})

Options

NameDescriptionDefaultOther
properties--
tableIdTable IDnullselector
tHeadList of table header fieldsempty arrayheadings array
dataRaw data in json or data with fields ( see Example 2 )empty arraydata array, data object
rowsPerPageTable rows on the page1025, 50, 100
trTemplateTemplate of table rownulltemplate string
indexIf table lines must be numbered (doesn't need with trTemplate)falsetrue
langInterface language'en''ru', 'de'
responsiveMake table responsive for mobile ( see Example 5 )falsetrue
fieldsHandlerObject. Takes as parameter name of field as a function and return and set new data in this field ( see demo file )empty object-
methods--
new(data)Redraw table with new async data--
onLayoutChange()Do smth when table lauout is changed (after table is initially loaded, clicking on prev-next-num button or load new data)--

IE Support

10 (no responsive)

License

MIT

2.0.0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago