datatables.treeview.js
v0.3.2
Published
DataTables Tree View Plugin
Downloads
4
Readme
datatables.treeview.js
DataTables plugin to display child rows.
Installation
$ npm install datatables.treeview.js --save
Add node_modules/datatables.treeview/datatables.treeview.js
to your files.
Usage
$().dataTables({
treeView: {
hasChildren: row => row.children.length > 0,
getChildren: (row, callback) => callback(row.children),
},
/* ... */
});
With custom options:
$().dataTables({
treeView: {
loadingIcon: '<svg>...</svg>',
},
/* ... */
});
Each child row will be prepended with a spacer that you have to style.
For instance:
.dt-tree-spacer {
margin-left: 12px;
}
Available options
spacer
appended at the start of each child rowexpandIcon
default + iconcollapseIcon
if null, will not change the toggle element, but simply add a CSS class to itloadingIcon
shows until data comes back
You can change the default options by altering $.fn.dataTable.TreeView.defaultOption
.
Make changes
DO NOT make any change to datatables.treeview.js
directly. It is compiled from src/
.
Use the following commands:
gulp build
compiles all source files (once)gulp demo
runs the demo server and compiles for any changegulp lint
checks for lintingnpm test
runs tests oncenpm run test:watch
run tests + karma server