DataTable
A infinite-scrollable list that supports paging in of items
Installation
Examples
Properties
data
Array | IDataFunction
List of items to render. This can either be an array of objects or a function that will generate the array of objects. If you supply a function then pagination will be supported. The function expects 2 parameters - max
and last
and returns a promise that will resolve to the list of objects. max
specifies the maximum number of items to be returned.
columns
IDataTableColumn[]
List of columns to render column contains three(3) params - title : column title. this can be either a string or a function that returns a jsx element - width : width of the column. this can a percentage (20%), fixed with (100px) or null - renderColumn : content of the column. this is a function that returns a jsx element. this function will take a single argument item type of any
pageSize
number
The number of items to fetch in each page. This gets passed to the data function as the max
parameter
args
any
renderLoading
() => JSX.Element
This function renders a loading animation. If not specified, the default loading animation will be used.
className
string
Any extra class names to be added to the component
showFooter
boolean
show/hide footer (scroll buttons)
scrollStep
number
mun of rows to scroll
showEndOfContent
boolean
show/hide end of content message
onItemsLoad
(total: number, loaded: number) => void
this function will be called every time list get updated this will return total number of items (function should return the total count) and loaded items count
renderHeaders
boolean
this will toggle the headers default is true
onClickRow
(item: any) => void
callback function to trigger on click a table row
activeClass
string
active table row styles default is 'active' an has some styles if you give a class here it will be applied
data
List of items to render. This can either be an array of objects or a function that will generate the array of objects. If you supply a function then pagination will be supported. The function expects 2 parameters - max
and last
and returns a promise that will resolve to the list of objects. max
specifies the maximum number of items to be returned.
Array | IDataFunction
columns
List of columns to render column contains three(3) params
title : column title. this can be either a string or a function that returns a jsx element
width : width of the column. this can a percentage (20%), fixed with (100px) or null
renderColumn : content of the column. this is a function that returns a jsx element. this function will take a single argument item type of any
IDataTableColumn[]
pageSize
The number of items to fetch in each page. This gets passed to the data function as the max
parameter
number
args
any
renderLoading
This function renders a loading animation. If not specified, the default loading animation will be used.
() => JSX.Element
className
Any extra class names to be added to the component
string
showFooter
show/hide footer (scroll buttons)
boolean
scrollStep
mun of rows to scroll
number
showEndOfContent
show/hide end of content message
boolean
onItemsLoad
this function will be called every time list get updated this will return total number of items (function should return the total count) and loaded items count
(total: number, loaded: number) => void
renderHeaders
this will toggle the headers default is true
boolean
onClickRow
callback function to trigger on click a table row
(item: any) => void
activeClass
active table row styles default is 'active' an has some styles if you give a class here it will be applied
string
Last updated