-
Notifications
You must be signed in to change notification settings - Fork 78
Events
Vanilla-DataTables fires it's own events which you can listen for by utilising the .on()
method:
var dataTable = new DataTable(myTable);
dataTable.on('datatable.XXXX', function(args) {
// Do something when datatable.XXXX fires
});
Fires when the table is fully rendered and ready for use.
Fires when the .refresh()
method is called.
Fires when the .update()
method is called.
Fires on page change.
A single argument is available which returns the page number:
dataTable.on('datatable.page', function(page) {
//
});
Fires when the table is sorted.
Two arguments are available when listening for this event: column
which returns the column index and direction
which returns the sort direction:
dataTable.on('datatable.sort', function(column, direction) {
//
});
Fires when the perPage option is changed with the dropdown. A single argument returns the per-page value:
dataTable.on('datatable.perpage', function(perpage) {
//
});
Fires on keyup during a search.
Two arguments are available: query
which returns the query string entered and matched
which returns an array of rows containing the matched string:
dataTable.on('datatable.search', function(query, matched) {
//
});
- datatable.init
- datatable.refresh
- datatable.update
- datatable.page
- datatable.sort
- datatable.perpage
- datatable.search
- perPage
- perPageSelect
- nextPrev
- prevText
- nextText
- firstLast
- firstText
- lastText
- searchable
- sortable
- truncatePager
- fixedColumns
- fixedHeight
- columns
- data
- ajax
- labels
- layout
- header
- footer
- table
- head DEPRECATED
- body DEPRECATED
- foot DEPRECATED
- wrapper
- container
- pagers
- headings
- options DEPRECATED
- initialized
- isIE DEPRECATED
- data
- activeRows DEPRECATED
- dataIndex
- pages
- hasRows
- hasHeadings
- currentPage
- totalPages
- onFirstPage
- onLastPage
- searching
- searchData