Skip to content

Commit aaa241a

Browse files
author
Andrej Gajdos
committed
Revert "Revert "adding show/hide event listeners""
This reverts commit 7f639db.
1 parent 7f639db commit aaa241a

12 files changed

+870
-366
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Dependency directories
22
node_modules
3-
bower_components
43

54
.DS_Store
65
npm-debug.log

README.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var table = new lib.NestedTables("example", data, settigns);
1919
table.initializeTableHierarchy();
2020
```
2121

22-
## API
22+
## Methods
2323

2424
### NestedTables(wrapperID, data, settings)
2525

@@ -47,6 +47,32 @@ Settings for jQuery DataTables constructor.
4747

4848
Build nested table hierarchy.
4949

50+
## Events
51+
52+
#### onShowChildHierarchy
53+
54+
Triggered when a child hierarchy is shown
55+
56+
```js
57+
// '#example' is wrapper ID for table hierarchy
58+
var tableEle = document.querySelector( "#example .table" );
59+
tableEle.addEventListener("onShowChildHierarchy", function(e) {
60+
console.log(e);
61+
});
62+
```
63+
64+
#### onHideChildHierarchy
65+
66+
Triggered when a child hierarchy is hidden
67+
68+
```js
69+
// '#example' is wrapper ID for table hierarchy
70+
var tableEle = document.querySelector( "#example .table" );
71+
tableEle.addEventListener("onHideChildHierarchy", function(e) {
72+
console.log(e);
73+
});
74+
```
75+
5076
## Example
5177

5278
```html

dist/nested.datatables.js dist/nested.tables.js

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nested.datatables.min.js dist/nested.tables.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel="stylesheet" type="text/css" media="screen" href="/nested-datatables/assets/css/style.css?v=cd7a2da0f2f66a8c86379cbde71985cbd9e0c742">
1111

1212
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
13-
<script src="/nested-datatables/dist/nested.datatables.min.js"></script>
13+
<script src="/nested-datatables/dist/nested.tables.min.js"></script>
1414

1515
<style>
1616
footer {
@@ -208,8 +208,16 @@ <h3 id="demo">Demo</h3>
208208
"bInfo": false
209209
};
210210

211-
var table = new lib.NestedTables("example", dataInJson, settigns);
211+
var table = new nestedTables.TableHierarchy("example", dataInJson, settings);
212212
table.initializeTableHierarchy();
213+
214+
var tableEle = document.querySelector( "#example .table" );
215+
tableEle.addEventListener("onShowChildHierarchy", function(e) {
216+
console.log(e);
217+
});
218+
tableEle.addEventListener("onHideChildHierarchy", function(e) {
219+
console.log(e);
220+
});
213221
</script>
214222

215223
<h3 id="jsfiddle"><a href='https://jsfiddle.net/andrej_gajdos/zu11wk2o/'>JSFiddle</a></h3>

index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
import NestedTables from './src/script/NestedTables'
2-
3-
export {NestedTables};
1+
import TableHierarchy from './src/script/NestedTables'
2+
export {TableHierarchy};

0 commit comments

Comments
 (0)