|
Name
|
Type
|
Default
|
|
width
|
Number/String
|
null
|
Sets the tree width.
Code examples
Initialize a jqxTree with the width property specified.
$('#jqxTree').jqxTree({width:"200px"});
|
|
height
|
Number/String
|
null
|
Sets the panel height.
Code examples
Initialize a jqxTree with the height property specified.
$('#jqxTree').jqxTree({height:"400px"});
|
|
disabled
|
Boolean
|
false
|
Gets or sets whether the tree is disabled.
Code examples
Initialize a jqxTree with the disabled property specified.
$('#jqxTree').jqxTree({ disabled:true });
|
|
theme
|
String
|
''
|
Sets the widget's theme.
jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file.
In order to set a theme, you need to do the following:
|
|
easing
|
String
|
'easeInOutCirc'
|
Gets or sets the animation's easing to one of the JQuery's supported easings.
Code examples
Initialize a jqxTree with the easing property specified.
$('#jqxTree').jqxTree({ easing: 'easeInOutCirc' });
|
|
animationShowDuration
|
Number
|
350
|
Gets or sets the duration of the show animation.
Code examples
Initialize a jqxTree with the animationShowDuration property specified.
$('#jqxTree').jqxTree({ animationShowDuration: 500 });
|
|
animationHideDuration
|
Number
|
fast
|
Gets or sets the duration of the hide animation.
Code examples
Initialize a jqxTree with the animationHideDuration property specified.
$('#jqxTree').jqxTree({ animationHideDuration: 500 });
|
|
enableHover
|
Boolean
|
true
|
Enables or disables the hover state.
Code examples
Initialize a jqxTree with the enableHover property specified.
$('#jqxTree').jqxTree({ enableHover: true });
|
|
keyboardNavigation
|
Boolean
|
true
|
Enables or disables the key navigation.
Code examples
Initialize a jqxTree with the keyboardNavigation property specified.
$('#jqxTree').jqxTree({ keyboardNavigation: true });
|
|
toggleMode
|
String
|
dblclick
|
Gets or sets user interaction used for expanding or collapsing any item. Possible values ['click', 'dblclick'].
Code examples
Initialize a jqxTree with the toggleMode property specified.
$('#jqxTree').jqxTree({ toggleMode: 'click' });
|
|
source
|
Object
|
null
|
Specifies the jqxTree's data source. Use this property to populate the jqxTree.
Code examples
Initialize a jqxTree with the source property specified.
var source = [
{ label: "Item 1", expanded: true, items: [
{ label: "Item 1.1" },
{ label: "Item 1.2", selected: true }
]
},
{ label: "Item 2" },
{ label: "Item 3" },
{ label: "Item 4", items: [
{ label: "Item 4.1" },
{ label: "Item 4.2" }
]
},
{ label: "Item 5" },
{ label: "Item 6" },
{ label: "Item 7" }
];
// create jqxTree
$('#jqxTree').jqxTree({ source: source, width: '330px'});
|
|
checkboxes
|
Boolean
|
false
|
Gets or sets whether the tree should display a checkbox next to each item. In order to use this feature, you need
to include the jqxcheckbox.js.
Code examples
Initialize a jqxTree with the checkboxes property specified.
$('#jqxTree').jqxTree({ checkboxes: true });
|
|
hasThreeStates
|
Boolean
|
false
|
Gets or sets whether the tree checkboxes have three states - checked, unchecked and indeterminate.
Code examples
Initialize a jqxTree with the hasThreeStates property specified.
$('#jqxTree').jqxTree({ hasThreeStates: true });
|
|
allowDrag(requires jqxdragdrop.js)
|
Boolean
|
false
|
Enables the dragging of Tree Items.
Code example
Initialize a jqxTree with the allowDrag property
specified.
$("#jqxTree").jqxTree({allowDrag:true});
|
|
allowDrop(requires jqxdragdrop.js)
|
Boolean
|
false
|
Enables the dropping of Tree Items.
Code example
Initialize a jqxTree with the allowDrop property
specified.
$("#jqxTree").jqxTree({allowDrop:true});
|
|
dragStart
|
Function
|
null
|
Callback function which is called when a drag operation starts.
Code example
Set the dragStart property
$("#jqxTree").jqxTree({dragStart: function (item) {
// disable dragging of 'Café au lait' item.
if (item.label == 'Café au lait')
return false;
// enable dragging for the item.
return true;
}
});
|
|
dragEnd
|
Function
|
null
|
Callback function which is called when a drag operation ends.
Code example
Set the dragEnd property
$('#tree').jqxTree({ allowDrag: true, allowDrop: true, height: '300px', width: '220px',
dragEnd: function (dragItem, dropItem, args, dropPosition, tree) {
// dragItem is the item which is dragged by the user.
// dropItem is the item over which we dropped the dragged item.
// args - dragEvent event arguments.
// dropPosition - the position of the dragItem regarding the possition of the dropItem. The possible values are: 'inside' - when the dragItem is dropped over the dropItem,
'before' - when the dragItem is dropped above the dropItem.
'after' - when the dragItem is dropped below the dropItem.
// tree - the jqxTree's jQuery object associated to the dropItem. If the tree's id is 'tree', this returns $("#tree")
// to cancel the drop operation, return false.
}
});
|
|
toggleIndicatorSize
|
Number
|
16
|
Gets or sets whether the size of the expand/collapse arrows.
Code examples
Initialize a jqxTree with the toggleIndicatorSize property specified.
$('#jqxTree').jqxTree({ toggleIndicatorSize: 0 });
|
|
|
|
expand
|
Event
|
|
Expand is triggered when the user expands a tree item.
Code examples
Bind to the expand event by type: jqxTree.
$('#jqxTree').bind('expand', function (event) {
var args = event.args;
var item = $('#jqxTree').jqxTree('getItem', args.element);
var label = item.label;
});
|
|
collapse
|
Event
|
|
Collapse is triggered when the user collapses a tree item.
Code examples
Bind to the collapse event by type: jqxTree.
$('#jqxTree').bind('collapse',function (event) {
var args = event.args;
var item = $('#jqxTree').jqxTree('getItem', args.element);
var label = item.label;
});
|
|
select
|
Event
|
|
Select is triggered when the user selects a tree item.
Code examples
Bind to the select event by type: jqxTree.
$('#jqxTree').bind('select',
function (event) {
var args = event.args;
var item = $('#jqxTree').jqxTree('getItem', args.element);
var label = item.label;
});
|
|
initialized
|
Event
|
|
The initialized event is triggered when the jqxTree is created and initialized.
Code examples
Bind to the initialized event by type: jqxTree.
$('#jqxTree').bind('initialized', function (event) { // Some code here. });
|
|
add
|
Event
|
|
Add event is triggered when the user adds a new tree item.
Code examples
Bind to the add event by type: jqxTree.
$('#jqxTree').bind('add', function (event) { // Some code here. });
|
|
removed
|
Event
|
|
Removed event is triggered when the user removes a tree item.
Code examples
Bind to the remove event by type: jqxTree.
$('#jqxTree').bind('remove', function (event) { // Some code here. });
|
|
checkChange
|
Event
|
|
checkChange is triggered when the user checks, unchecks or the checkbox is in indeterminate state.
Code examples
Bind to the checkChange event by type: jqxTree.
$('#jqxTree').bind('checkChange', function (event)
{
var args = event.args;
var element = args.element;
var checked = args.checked;
});
|
|
dragStart
|
Event
|
|
This event is triggered when the user starts a drag operation.
Code example
Bind to the dragStart event by type: jqxTree.
$("#tree").bind('dragStart', function (event) {
// get item's label.
var itemLabel = event.args.label;
// get item's value.
var itemValue = event.args.value;
// get the original dragStart event from the jqxDragDrop plug-in.
var originalEvent = event.args.originalEvent;
// using the originalEvent, you can retrieve the mouse cursor's position.
var x = event.args.originalEvent.pageX;
var y = event.args.originalEvent.pageY;
if (event.args.originalEvent.originalEvent.touches) {
var touch = event.args.originalEvent.originalEvent.changedTouches[0];
x = touch.pageX;
y = touch.pageY;
}
});
|
|
dragEnd
|
Event
|
|
This event is triggered when the user drops an item.
Code example
Bind to the dragEnd event by type: jqxTree.
$("#tree").bind('dragEnd', function (event) {
// get item's label.
var itemLabel = event.args.label;
// get item's value.
var itemValue = event.args.value;
// get the original dragStart event from the jqxDragDrop plug-in.
var originalEvent = event.args.originalEvent;
// using the originalEvent, you can retrieve the mouse cursor's position.
var x = event.args.originalEvent.pageX;
var y = event.args.originalEvent.pageY;
if (event.args.originalEvent.originalEvent.touches) {
var touch = event.args.originalEvent.originalEvent.changedTouches[0];
x = touch.pageX;
y = touch.pageY;
}
});
|
|
|
|
ensureVisible
|
Method
|
|
Ensures the visibility of an element.
Code example
Invoke the ensureVisible method.
// @param element (li tag)
$('#jqxTree').jqxTree('ensureVisible', element);
|
|
addTo
|
Method
|
|
Adds an element.
Code example
Invoke the addTo method.
// @param element (li tag)
// @param parentElement (li tag) - optional parameter, which specifies the parent item. If not specified, the new element is added as last tree item.
$('#jqxTree').jqxTree('addTo', element, parentElement);
The following code adds a new item to the jqxTree:
$('#jqxTree').jqxTree('addTo', { label: 'Item' });
The following code adds a new sub item to the first tree item:
var treeItems = $("#jqxTree").jqxTree('getItems');
var firstItem = treeItems[0];
var firstItemElement = firstItem.element;
$('#jqxTree').jqxTree('addTo', { label: 'Item' }, firstItemElement);
The following code adds a new sub item to a tree item by using the item's ID.
var elementByID = $('#jqxTree').find("#home")[0];
$('#jqxTree').jqxTree('addTo', { label: 'Item' }, elementByID);
The following code adds a new item with custom HTML and specific ID to the jqxTree.
$('#jqxTree').jqxTree('addTo', { html: <span style='font-weight: bold;' id='myItem'>Item });
|
|
removeItem
|
Method
|
|
Removes an element.
Code example
Invoke the removeItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('removeItem', element);
|
|
clear
|
Method
|
|
Removes all elements.
Code example
Invoke the clear method.
$('#jqxTree').jqxTree('clear');
|
|
disableItem
|
Method
|
|
Disables a tree item.
Code example
Invoke the disableItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('disableItem', element);
|
|
checkAll
|
Method
|
|
Checks all tree items.
Code example
Invoke the checkAll method.
$('#jqxTree').jqxTree('checkAll');
|
|
uncheckAll
|
Method
|
|
Unchecks all tree items.
Code example
Invoke the uncheckAll method.
$('#jqxTree').jqxTree('uncheckAll');
|
|
checkItem
|
Method
|
|
Checks a tree item.
Code example
Invoke the checkItem method.
// @param element (li tag)
// @param true, false or null. - CheckBox state.
$('#jqxTree').jqxTree('checkItem', element, true);
// check an item with id="home"
var newCheckState = true;
$("#jqxTree").jqxTree('checkItem', $("#home")[0], newCheckState);
|
|
uncheckItem
|
Method
|
|
Unchecks a tree item.
Code example
Invoke the uncheckItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('uncheckItem', element);
// uncheck an item with id="home"
var newCheckState = true;
$("#jqxTree").jqxTree('uncheckItem', $("#home")[0]);
|
|
enableItem
|
Method
|
|
Enables a tree item.
Code example
Invoke the enableItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('enableItem', element);
|
|
lockItem
|
Method
|
|
Locks a tree item.
Code example
Invoke the lockItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('lockItem', element);
|
|
unlockItem
|
Method
|
|
Unlocks a tree item.
Code example
Invoke the unlockItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('unlockItem', element);
|
|
getCheckedItems
|
Method
|
|
Gets an array with all checked tree items.
Each tree item has the following fields:
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getCheckedItems method.
var items = $('#jqxTree').jqxTree('getCheckedItems');
|
|
getUncheckedItems
|
Method
|
|
Gets an array with all unchecked tree items.
Each tree item has the following fields:
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getUncheckedItems method.
var items = $('#jqxTree').jqxTree('getUncheckedItems');
|
|
getItems
|
Method
|
|
Gets an array with all tree items.
Each tree item has the following fields:
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getItems method.
var items = $('#jqxTree').jqxTree('getItems');
|
|
getItem
|
Method
|
|
Gets the tree item associated to a LI tag passed as parameter.
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getItem method.
// @param element (li tag)
var item = $('#jqxTree').jqxTree('getItem', element);
|
|
getSelectedItem
|
Method
|
|
Gets the selected tree item.
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getSelectedItem method.
var item = $('#jqxTree').jqxTree('getSelectedItem');
|
|
getPrevItem
|
Method
|
|
Gets the item above another item.
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getPrevItem method.
var selectedItem = $("#jqxTree").jqxTree('selectedItem');
var prevItem = $("#jqxTree").jqxTree('getPrevItem', selectedItem.element);
|
|
getNextItem
|
Method
|
|
Gets the item below another item.
Item Fields
- label - gets item's label.
- value - gets the item's value.
- disabled - gets whether the item is enabled/disabled.
- checked - gets whether the item is checked/unchecked.
- element - gets the item's LI tag.
- parentElement - gets the item's parent LI tag.
- isExpanded - gets whether the item is expanded or collapsed.
- selected - gets whether the item is selected or not.
Code example
Invoke the getNextItem method.
var selectedItem = $("#jqxTree").jqxTree('selectedItem');
var nextItem = $("#jqxTree").jqxTree('getNextItem', selectedItem.element);
|
|
selectItem
|
Method
|
|
Selects an item.
Code example
Invoke the selectItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('selectItem', element);
Code example
Invoke the selectItem method.
$('#jqxTree').jqxTree('selectItem', $("#jqxTree").find('li:first')[0]);
// Select item with id="home"
$("#jqxTree").jqxTree('selectItem', $("#home")[0]);
|
|
collapseAll
|
Method
|
|
Collapses all items.
Code example
Invoke the collapseAll method.
$('#jqxTree').jqxTree('collapseAll');
|
|
expandAll
|
Method
|
|
Expandes all items.
Code example
Invoke the expandAll method.
$('#jqxTree').jqxTree('expandAll');
|
|
collapseItem
|
Method
|
|
Collapses a tree item by passing an element as parameter.
Code example
Invoke the collapseItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('collapseItem', element);
// Collapse item with id="home"
$("#jqxTree").jqxTree('collapseItem', $("#home")[0]);
|
|
expandItem
|
Method
|
|
Expands a tree item by passing an element as parameter.
Code example
Invoke the expandItem method.
// @param element (li tag)
$('#jqxTree').jqxTree('expandItem', element);
// Expand item with id="home"
$("#jqxTree").jqxTree('expandItem', $("#home")[0]);
|
|
render
|
Method
|
|
Renders the jqxTree widget.
Code example
Invoke the render method.
$('#jqxTree').jqxTree('render');
|
|
refresh
|
Method
|
|
Refreshes the jqxTree widget. The refresh method will update the jqxTree's layout and size.
Code example
Invoke the refresh method.
$('#jqxTree').jqxTree('refresh');
|
|
destroy
|
Method
|
|
Destroy the jqxTree widget. The destroy method removes the jqxTree widget from the web page.
Code example
Invoke the destroy method.
$('#jqxTree').jqxTree('destroy');
|