Skip to content

Commit 2bf42e7

Browse files
Remove vaadin
Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
1 parent c4f0b24 commit 2bf42e7

File tree

4 files changed

+138
-1812
lines changed

4 files changed

+138
-1812
lines changed

example/index.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ <h1>Directory Tree</h1>
3030
<!-- Add a button to trigger the file selection -->
3131
<div class="row">
3232
<button id="selectFileButton">Select "Folder1/SubFolder1/File2.txt"</button>
33+
<button id="collapseAllButton">Collapse All</button>
34+
<button id="expandAllButton">Expand All</button>
3335
</div>
3436

3537
<script>
@@ -50,19 +52,27 @@ <h1>Directory Tree</h1>
5052
{ name: 'File3.txt', type: 'file' },
5153
];
5254

53-
// Get a reference to the directory tree component
5455
const treeComponent = document.querySelector('#directoryTree');
5556
treeComponent.directory = directoryData;
5657

57-
// Add an event listener for the button click to programmatically select a file
5858
document.querySelector('#selectFileButton').addEventListener('click', () => {
5959
const filePath = 'Folder1/SubFolder1/File2.txt';
6060
treeComponent.selectFile(filePath);
6161
});
6262

63-
// Listen for file selection events
63+
64+
document.querySelector('#collapseAllButton').addEventListener('click', () => {
65+
treeComponent.collapseAll();
66+
});
67+
68+
document.querySelector('#expandAllButton').addEventListener('click', () => {
69+
treeComponent.expandAll();
70+
});
71+
6472
treeComponent.addEventListener('file-select', (event) => {
6573
console.log('File selected:', event.detail.file);
74+
console.log('Is it a file?', event.detail.isFile);
75+
console.log('Node type:', event.detail.nodeType);
6676
});
6777
</script>
6878
</body>

0 commit comments

Comments
 (0)