Methods
external:"jQuery.fn.mzDropDownTree"()
main callback to render a tree div from options object
- Source:
Examples
Initialize basic tree. see example_basic
<div id="your-tree-id"></div>
<script>
$("#your-tree-id").mzDropDownTree({options})
</script>
Initialize basic tree with data attributes.
<div id="your-tree-id" data-label="Label" data-description="Description of the tree"></div>
<script>
$("#your-tree-id").mzDropDownTree({options})
</script>
declaring the static data property for the tree
defaultOptions.data = {
label:"Label of the option"
value: "12345"
children:{
{
label:"Label",
value:"Value"
},
{
label:"Label",
value:"Value"
children:[
{
label:"Label",
value:"value"
}
]
}
}
}
Declaring remote data property.
-NOTE: That the remote data property must return a numeric childcount
returned data from URL source must include child count
{
label:"Label"
value: "value"
children: 10|0|1
}
tree node is fetched again when the tree node is expanded.
defaultOptions.data{
url:"URL TO YOUR SOURCE"
method: "[POST|GET]" default is GET
data: data
}
Type Definitions
defaultOptions
The default options for the tree. Default options can be overridden by initinaliing the tree with options object the div's data-attributes
Type:
- Object
Properties:
| Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
key |
string | Required key name of the tree, data is submitted against this key value | ||||||||||||||||||||||||||||||||||||||||||
data |
Object | Required data property for the tree, the tree is constructed from nested nodes of data object
Properties
|
||||||||||||||||||||||||||||||||||||||||||
label |
string | Label of the tree filter, tree filter is focused when this label is clicked. | ||||||||||||||||||||||||||||||||||||||||||
description |
string | The Description or help text for the tree | ||||||||||||||||||||||||||||||||||||||||||
mode |
string |
<optional> |
The mode of the tree, its either a tree or flat. | |||||||||||||||||||||||||||||||||||||||||
default_value |
Array | Object | The default values with | ||||||||||||||||||||||||||||||||||||||||||
placeholder |
string |
<optional> |
The placeholder text field for the tree | |||||||||||||||||||||||||||||||||||||||||
select_options |
object |
<optional> |
selection configuration for the tree
Properties
|
|||||||||||||||||||||||||||||||||||||||||
filter_options |
object | Filter options for tree
Properties
|
||||||||||||||||||||||||||||||||||||||||||
tree_options |
object | tree header options such as select all show selected etc.
Properties
|
||||||||||||||||||||||||||||||||||||||||||
onNodeSelect |
object | callback is engaged when a node is selected. It exposes node, nodes and totalNodes. Example: options.onNodeSelect:function(node, nodes, totalNodes) | ||||||||||||||||||||||||||||||||||||||||||
onTreeRender |
object | callback is engaged when the tree has finished rendering process. Add remove or modify tree nodes in this callback. options.OnTreeRender:function(tree){} | ||||||||||||||||||||||||||||||||||||||||||
OnDetailOpen |
object | callback is engaged on Remote Data property, when the detail arrow or sign has been clicked or the tree parent node is expanded, use this to modify the payload sent to the target URL. Example: options.onDetailOpen:function(data) | ||||||||||||||||||||||||||||||||||||||||||
onTextFilterChange |
object | callback is engaged when the filter has changed | ||||||||||||||||||||||||||||||||||||||||||
onTextFilterFocus |
object | callback is engaged when the the text filter receives focus. Use this to modify the open and close behavior of the tree |
- Source: