jQuery datatreeview property configuration - maikelbos0/VDT GitHub Wiki
The treeview nodes that the datatreeview creates are based on an array of data nodes that can each optionally contain an array of child data nodes. By default, the plugin uses the following properties on the data node objects:
-
valuefor the value for input checkboxes -
selectedto determine the selected status of the checkboxes -
textfor the label text -
childrenfor possible child nodes
These defaults can be simply overriden by setting the properties data-value-property, data-selected-property, data-text-property and data-children-property on the main treeview element.
<div id="example-treeview" data-value-property="data" data-selected-property="checked" data-text-property="description" data-children-property="childNodes"></div>
<script type="text/javascript">
$('#example-treeview').datatreeview({
data: [
{
data: '1',
description: 'Foo',
childNodes: [
{ data: '4', description: 'Quux', checked: true },
{ data: '5', description: 'Quuux' }
]
},
{ data: '2', description: 'Bar', checked: true },
{ data: '3', description: 'Baz' }
]
});
</script>