addSlice = function() {
                var start = index;
                for (var i=0;i<sliceSize;i++) {
                    index = start+i;
                    if (index === children.length) {
                        setTimeout(function() {
                            if (onCompleteChildren) {
                                onCompleteChildren();
                            }
                        },10);
                        return;
                    }
                    children[index].parent = parent;
                    subtree.editableList('addItem',children[index])
                }
                index++;
                if (index < children.length) {
                    setTimeout(function() {
                        addSlice();
                    },10);
                }
            }
options:
  - data : array - initial items to display in tree
  - multi : boolean - if true, .selected will return an array of results
                      otherwise, returns the first selected item
  - sortable: boolean/string - TODO: see editableList
  - selectable: boolean - default true - whether individual items can be selected
  - rootSortable: boolean - if 'sortable' is set, then setting this to
                            false, prevents items being sorted to the
                            top level of the tree
  - autoSelect: boolean - default true - triggers item selection when navigating
                          list by keyboard. If the list has checkboxed items
                          you probably want to set this to false

methods:
  - data(items) - clears existing items and replaces with new data
  - clearSelection - clears the selected items
  - filter(filterFunc) - filters the tree using the provided function
events:
  - treelistselect : function(event, item) {}
  - treelistconfirm : function(event,item) {}
  - treelistchangeparent: function(event,item, oldParent, newParent) {}

data:
[
    {
        label: 'Local', // label for the item
        sublabel: 'Local', // a sub-label for the item
        icon: 'fa fa-rocket', // (optional) icon for the item
        checkbox: true/false, // (optional) if present, display checkbox accordingly
        radio: 'group-name',  // (optional) if present, display radio box - using group-name to set radio group
        selected: true/false, // (optional) whether the item is selected or not
        children: [] | function(done,item) // (optional) an array of child items, or a function
                                      // that will call the `done` callback with an array
                                      // of child items
        expanded: true/false, // show the child items by default
        deferBuild: true/false, // don't build any ui elements for the item's children
                                   until it is expanded by the user.
        element: // custom dom element to use for the item - ignored if `label` is set
        collapsible: true/false, // prevent a parent item from being collapsed. default true.
    }
]

var treeList = $("<div>").css({width: "100%", height: "100%"}).treeList({data:[...]})
treeList.on('treelistselect', function(e,item) { console.log(item)})
treeList.treeList('data',[ ... ] )


After `data` has been added to the tree, each item is augmented the following
properties and functions:

  item.parent - set to the parent item
  item.depth - the depth in the tree (0 == root)
  item.treeList.container
  item.treeList.label - the label element for the item
  item.treeList.parentList  - the editableList instance this item is in
  item.treeList.remove(detach) - removes the item from the tree. Optionally detach to preserve any event handlers on the item's label
  item.treeList.makeLeaf(detachChildElements) - turns an element with children into a leaf node,
                                                removing the UI decoration etc.
                                                detachChildElements - any children with custom
                                                elements will be detached rather than removed
                                                so jQuery event handlers are preserved in case
                                                the child elements need to be reattached later
  item.treeList.makeParent(children) - turns an element into a parent node, adding the necessary
                                       UI decoration.
  item.treeList.insertChildAt(newItem,position,select) - adds a child item an the specified position.
                                                         Optionally selects the item after adding.
  item.treeList.addChild(newItem,select) - appends a child item.
                                           Optionally selects the item after adding.
  item.treeList.expand(done) - expands the parent item to show children. Optional 'done' callback.
  item.treeList.collapse() - collapse the parent item to hide children.
  item.treeList.sortChildren(sortFunction) - does a one-time sort of the children using sortFunction
  item.treeList.replaceElement(element) - replace the custom element for the item