jQuery datatreeview collapsed - maikelbos0/VDT GitHub Wiki

When creating a datatreeview, sometimes you want the treeview nodes to be collapsed instead of expanded at initizalization. To achieve this, set the data-collapsed attribute to 'true'.

<div id="example-treeview" data-collapsed="true">
</div>

<script type="text/javascript">
    $('#example-treeview').datatreeview({
        data: [
            {
                value: '1',
                text: 'Foo',
                children: [
                    { value: '4', text: 'Quux' },
                    { value: '5', text: 'Quuux' }
                ]
            },
            { value: '2', text: 'Bar' },
            { value: '3', text: 'Baz' }
        ]
    });
</script>
⚠️ **GitHub.com Fallback** ⚠️