JavaScript
;(function ($, window, document, undefined) {
/*global jQuery, console*/
'use strict';
var pluginName = 'treeview';
var _default = {};
_default.settings = {
injectStyle: true,
levels: 2,
expandIcon: 'glyphicon glyphicon-plus',
collapseIcon: 'glyphicon glyphicon-minus',
emptyIcon: 'glyphicon',
nodeIcon: '',
selectedIcon: '',
checkedIcon: 'glyphicon glyphicon-check',
uncheckedIcon: 'glyphicon glyphicon-unchecked',
color: undefined, // '#000000',
backColor: undefined, // '#FFFFFF',
borderColor: undefined, // '#dddddd',
onhoverColor: '#F5F5F5',
selectedColor: '#FFFFFF',
selectedBackColor: '#428bca',
searchResultColor: '#D9534F',
searchResultBackColor: undefined, //'#FFFFFF',
enableLinks: false,
highlightSelected: true,
highlightSearchResults: true,
showBorder: true,
showIcon: true,
showCheckbox: false,
showTags: false,
multiSelect: false,
// Event handlers
onNodeChecked: undefined,
onNodeCollapsed: undefined,
onNodeDisabled: undefined,
onNodeEnabled: undefined,
onNodeExpanded: undefined,
onNodeSelected: undefined,
onNodeUnchecked: undefined,
onNodeUnselected: undefined,
onSearchComplete: undefined,
onSearchCleared: undefined
};
_default.options = {
silent: false,
ignoreChildren: false
};
_default.searchOptions = {
ignoreCase: true,
exactMatch: false,
revealResults: true
};
var Tree = function (element, options) {
this.$element = $(element);
this.elementId = element.id;
this.styleId = this.elementId + '-style';
this.init(options);
return {
// Options (public access)
options: this.options,
// Initialize / destroy methods
init: $.proxy(this.init, this),
remove: $.proxy(this.remove, this),
// Get methods
getNode: $.proxy(this.getNode, this),
getParent: $.proxy(this.getParent, this),
getSiblings: $.proxy(this.getSiblings, this),
getSelected: $.proxy(this.getSelected, this),
getUnselected: $.proxy(this.getUnselected,...