Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanety/jquery-simple-tree-table
https://github.com/kanety/jquery-simple-tree-table
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kanety/jquery-simple-tree-table
- Owner: kanety
- License: mit
- Created: 2018-12-08T00:46:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-23T02:01:17.000Z (almost 4 years ago)
- Last Synced: 2024-11-09T09:03:09.296Z (2 months ago)
- Language: JavaScript
- Size: 58.6 KB
- Stars: 11
- Watchers: 5
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jquery-simple-tree-table
A jquery plugin that attaches tree-like behaviour to table.
## Dependencies
* jquery
## Installation
Install from npm:
$ npm install @kanety/jquery-simple-tree-table --save
## Usage
Add `data-node-id` and `data-node-pid` in your table:
```html
1
text of 1
1.1
text of 1.1
1.1.1
text of 1.1.1
1.1.2
text of 1.1.2
```
Then run:
```javascript
$('table').simpleTreeTable();
```### Options
Specify opened nodes:
```javascript
$('table').simpleTreeTable({
opened: [1]
});
```Add expand / collapse button:
```javascript
$('table').simpleTreeTable({
expander: '#expander',
collapser: '#collapser',
});
```Customize icon position:
```javascript
$('table').simpleTreeTable({
iconPosition: 'td:last-child'
});
```Store node states in sessionStorage or localStorage:
```javascript
$('table').simpleTreeTable({
store: 'session', // or 'local'
storeKey: 'KEY'
});
```### Callbacks
Run Callbacks when a node is opened or closed:
```javascript
$('table').simpleTreeTable({
...
}).on('node:open', function(e, $node) {
...
}).on('node:close', function(e, $node) {
...
});
```## License
The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).