jQuery EasyUI Form Plugin - Combotree Combination Tree
Extends from $.fn.combo.defaults and $.fn.tree.defaults. Overrides the default defaults with $.fn.combotree.defaults.
The combotree combines the selection control with a dropdown tree. It is similar to the combobox, but replaces the list with a tree component. The combotree supports trees with checkboxes for tree states for multi-selection.
Dependencies
- combo
- tree
Usage
Create a combotree from markup.
<select id="cc" class="easyui-combotree" style="width:200px;"
data-options="url:'get_data.php',required:true">
</select>
Create a combotree using JavaScript.
<input id="cc" value="01">
$('#cc').combotree({
url: 'get_data.php',
required: true
});
Properties
This property extends from combo and tree. Below are properties added or overridden for combotree.
Name | Type | Description | Default Value |
---|---|---|---|
editable | boolean | Defines whether the user can directly input text into the text field. | false |
Events
This event extends from combo and tree.
Methods
This method extends from combo. Below are methods added or overridden for combotree.
Name | Parameters | Description |
---|---|---|
options | none | Returns the options object. |
tree | none | Returns the tree object. The following example demonstrates how to get the selected tree node. var t = $('#cc').combotree('tree'); // get the tree object<br>var n = t.tree('getSelected'); // get selected node<br>alert(n.text); |
loadData | data | Loads local tree data. <br>Code example: $('#cc').combotree('loadData', [{<br> id: 1,<br> text: 'Languages',<br> children: [{<br> id: 11,<br> text: 'Java'<br> },{<br> id: 12,<br> text: 'C++'<br> }]<br>}]); |
reload | url | Requests remote tree data again. Pass the 'url' parameter to override the original URL value. |
clear | none | Clears the component's value. |
setValues | values | Sets an array of component values. <br>Code example: $('#cc').combotree('setValues', [1,3,21]); |
setValue | value | Sets the component's value. <br>Code example: $('#cc').combotree('setValue', 6); |