Example:
JSON:
{
  "tree": [
    { "text": "Ruby", "icon": "star", "checkbox": { "id": "ruby", "name": "languages[]", "value": "1", "class": "special" } },
    { "text": "Java", "link": "http://wbotelhos.com.br", "target": "_blank", "checkbox": { "id": "java", "name": "language[]", "value": "2" } },
    { "text": "NoSQL", "state": "opened", "checkbox": { "id": "nosql", "name": "language[]", "value": "3" }, "children": [
        { "text": "Neo4j", "checkbox": { "id": "neo4j", "name": "language[]", "value": "4" } },
        { "text": "Document", "checkbox": { "id": "document", "name": "language[]", "value": "5" }, "children": [
            { "text": "MongoDB", "checkbox": { "id": "mongodb", "name": "language[]", "value": "6", "checked": true } },
            { "text": "CouchDB", "checkbox": { "id": "couchdb", "name": "language[]", "value": "7" } }
          ]
        },
        { "text": "Relational", "checkbox": { "id": "relational", "name": "language[]", "value": "8", "disabled": true } }
      ]
    }
  ]
}

+ tree: the root of the JSON;
+ text: the text of each item of the tree;
+ icon: the icon putted on the left side of the text;
- link: the url of the text;
   + target: target of the link;
   + when this options is present the text is converted to a link.
- checkbox:
   + id: the field's ID;
   + name: the field's name;
   + value: the field's value;
   + class: the field's class.
   - checked: decide if the checkbox will be checked or not:
      + you can use: checked="checked", checked=true or just checked="".
   - disabled: decide if the checkbox will be disabled or not:
      + you can use: disabled="disabled", disabled=true or just disabled="".
- children: a node of the tree with other items;
   + state: the state of the folder: opened or closed;
   + when the children is present it treat as a folder.
Script:
$('#tree').treefy({
    checkbox : true,
    url      : 'http://mockr.me/treefy'
});
HTML:
<div id="tree"></div>
Options:
always: undefined / using undefined jQuery will consider it as: undefined
$('#tree').treefy({
  always : function(jqXHR, textStatus) {
    alert('Successfully completed!');
  },

  url    : '/treefy'
});
Function executed when the tree finish the request.
Explanation: you can stop a loading message when request finish.

checkbox: false
checkbox
$('#tree').treefy({
  checkbox : true,
  url      : '/treefy'
});
Enables the checkbox on the side of each element.
Explanation:
- You put a checkbox on the side of each elment of the tree to be possible check it;
- Different from current plugins, Treefy generates real checkboxes, not a div with an image of the checkbox;
- You can customize all part of checkbox using the 'checkbox' element of JSON, or build it manually.

checkDown: true
checkDown
$('#tree').treefy({
  checkbox  : true,
  checkDown : false
  url       : '/treefy',
});
Check all children when a folder is checked.
Explanation:
- The most common thing is check a folder to check all children, then let it on;
- If you wants just check the folder, but not the children just turn it off;
- This cover just the check option, not the uncheck.

checkedClass: 'treefy-checked'
checkedClass
.treefy-on { background: url('checked.png'); }
$('#tree').treefy({
  url          : '/treefy',
  checkedClass : 'on'
});
Class with background used as icon on checked values.
Explanation:
- You can change the background icon with one you like;
- The prefix 'treefy-' is preppended automatically to avoid conflicts.

checkUp: true
checkUp
$('#tree').treefy({
  checkbox : true,
  checkUp  : false,
  url      : '/treefy'
});
Check all parents folder.
Explanation:
- If a checkbox is a child, then if it is checked you parent is partial checked or full checked;
- If the parent has just one child, the parent is full checked, otherwise partial;
- You can disable this option to avoid check the parents if it represents some value and you don't want send it.

data: undefined
var json = '{ "tree": [ { "text": "Java" }, { "text": "Ruby" } ] }'
$('#tree').treefy({
  url  : '/treefy',
  data : json
});
A JSON data passed to Treefy manually.
Explanation:
- You can build your own JSON and pass it to the Treefy;
- Maybe you wants manipulate the JSON that cames from an ajax request and then pass it.

dataType: 'json' / using undefined jQuery will consider it as: Intelligent Guess (xml, json, script, or html)
$('#tree').treefy({
  url      : '/treefy',
  dataType : 'xml'
});
The data type of the ajax request.
Explanation: you can receive the data as XML. * For now just JSON is supported!

disabledCheckedClass: 'treefy-disabled-checked'
disabledCheckedClass
.treefy-checked-off { background: url('checked-off.png'); }
$('#tree').treefy({
  disabledCheckedClass : 'checked-off',
  url                  : '/treefy'
});
Class with background used as icon on checkbox is checked but disabled.
Explanation:
- You can have a checkbox checked, but it can be disabled, then choose an icon for it.

disabledClass: 'treefy-disabled'
disabledClass
.treefy-unchecked-off { background: url('unchecked-off.png'); }
$('#tree').treefy({
  disabledClass : 'unchecked-off',
  url           : '/treefy'
});
Class with background used as icon on checkbox is disabled.
Explanation:
- You can have a checkbox unchecked and disabled, then choose an icon for it;
- This is the read-only state.

disableFolder: true
disableFolder
$('#tree').treefy({
  disableFolder : false,
  url           : '/treefy'
});
Enables sending the value of items that are folders.
Explanation:
- By default the value setted on folder item is not submited, because it is disabled internally;
- Its happen because normally, the folder is just a grouper of other items;
- If your folder represents a value for your logic, then disable this option.

done: undefined / using undefined jQuery will consider it as: undefined
$('#tree').treefy({
  done : function(data, textStatus, jqXHR) {
    alert('Successfully loaded!');
  },

  url  : '/treefy'
});
Function executed when the tree loads successfully.
Explanation: you can get the data returned from request and display a success message.

fail: undefined / using undefined jQuery will consider it as: undefined
$('#tree').treefy({
  fail : function(jqXHR, textStatus, errorThrown) {
    alert('Some thing is wrong!');
  },

  url  : '/treefy'
});
Function executed when occurs an error.
Explanation: you can recover an error and display it, or take a workaround decision.

icon: true
icon
$('#tree').treefy({
  icon : false
  url  : '/treefy'
});
Enables the display of icons next to each item.
Explanation:
- All item of the tree can has an icon to a better explanation about the item;
- You can disable it to take of the item;
- This option just defined if the icon will be presented, not the name of icon.

jsonp: undefined / using undefined jQuery will consider it as: no effect.
$('#tree').treefy({
  jsonp : true,
  url   : '/treefy'
});
Override the callback function name in a jsonp request.
Explanation: you can override the callback name. jQuery 1.5+ you can set it to false to avoid append of "?callback" or "=?" and set the name using jsonpCallback option.

jsonpCallback: undefined / using undefined jQuery will consider it as: random value
$('#tree').treefy({
  jsonpCallback : 'MyCallbackName',
  url           : '/treefy'
});
Specify the callback function name for a JSONP request.
Explanation:
- You can change the name of callback manually;
- Using static name you can have a better browser caching;
- But it is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling

childrenName: 'children'
{ "tree": [ { "text": "NoSQL", "state": "opened", "node": [ { "text": "MongoDB" } ] } ] }
$('#tree').treefy({
  childrenName : 'node',
  url          : '/treefy'
});
Name of the node that represents the children.
Explanation: if you prefer to change the name because of an API parse os something.

params: {}
$('#tree').treefy({
  params : { 'language': 'pt_BR', 'status': 1 },
  url    : '/treefy'
});
...&language=pt_BR&status=1
A hash of parameters to be added to the query string.
Explanation: you can pass extra parameter to filter your search.

partial: true
partial
$('#tree').treefy({
  partial : false,
  url     : '/treefy'
});
Enables the partial icon of the folder.
Explanation:
- If you have more then one children and check just one, then the folder should be with partial icon;
- When you disable this option the folder always will be full checked instead partial.

partialClass: 'treefy-partial'
partialClass
.treefy-half { background: url('half.png'); }
$('#tree').treefy({
  partialClass : 'half',
  url          : '/treefy'
});
Class with background used as icon on checkbox is disabled.
Explanation:
- You can have a checkbox unchecked and disabled, then choose an icon for it;
- This is the read-only state.

type: 'get'
$('#tree').treefy({
  type : 'post',
  url  : '/treefy'
});
Type of the HTTP request.
Explanation: you can change the verb to get, post, delete or put, but it is a search, then it is recommended that you use the default get.

uncheckDown: true
uncheckDown
$('#tree').treefy({
  checkbox  : true,
  uncheckDown : false
  url       : '/treefy',
});
Uncheck all children when a folder is unchecked.
Explanation:
- When you uncheck a folder, normally you want uncheck all children;
- Maybe you want to foce the user uncheck one by one, but it is not good at all.

uncheckUp: true
uncheckUp
$('#tree').treefy({
  checkbox  : true,
  uncheckUp : false
  url       : '/treefy',
});
Uncheck all parents folder when a child is check.
Explanation:
- If a checkbox is the last checked child, then if it is unchecked the parent is unchecked too;
- If the parent represents a value by it self, maybe you don't wan unchecked it too.

uncheckedClass: 'treefy-unchecked'
uncheckedClass
.treefy-normal { background: url('normal.png'); }
$('#tree').treefy({
  uncheckedClass : 'normal',
  url            : '/treefy'
});
Class with background used as icon on checkbox unchecked.
Explanation: the first state of checkbox is unchecked, and it is the image of it.

url: undefined
$('#tree').treefy({
  url: '/user/treefy'
});
URL to request the data.
Explanation: you can change the URL to receive your data. Don't forget to prepend the context of your application.
Manual build:
$('#tree').treefy();

<div id="tree">
   <ul class="treefy">
      <li>
         <span>
            <span class="treefy-empty"></span>
            <label for="ruby" class="treefy-unchecked"></label>
            <input id="ruby" type="checkbox" />
            <span class="treefy-star"></span>
            <a href="javascript:void(0);">Ruby</a>
         </span>
      </li>
      <li>
         <span class="treefy-closed">
            <span class="treefy-flick"></span>
            <label for="nosql" class="treefy-unchecked"></label>
            <input id="nosql" type="checkbox" />
            <span class="treefy-folder"></span>
            <a href="javascript:void(0);">NoSQL</a>
         </span>

         <ul>
            <li>
               <span>
                  <span class="treefy-empty"></span>
                  <label for="mongodb" class="treefy-unchecked"></label>
                  <input id="mongodb" type="checkbox" />
                  <span class="treefy-file"></span>
                  <a href="javascript:void(0);">MongoDB</a>
               </span>
            </li>
         </ul>
      </li>
   </ul>
</div>
- If you want build manually, then you must follow the structure convention.
- Each 'li' is an element on the tree.
- The span inside li keep the information as expand/collapse icon, checkbox, icon and text of the item.
- If the item is a 'folder', then it has a 'flick' span and the states closed or opened declared on the main span.
- For no folder items, it is considered 'file' and has a 'empty' element instead a flick.
- The last item is a link with the text of the element.
- If the item has children, then it will be inside a <ul/> after the span.
Changing the settings globally:
$.fn.catchy.defaults.checkbox = true;
$.fn.catchy.defaults.icon = false;
- You can change any option mention the scope $.fn.treefy.defaults. + option_name;
- This setup must be called before you bind the Treefy, of course.
Public functions:
ID: check uncheck
ID: enable disable
$('#ruby').treefy('check', true);
Check or uncheck the checkbox.
$('#java').treefy('enable', false);
Disable or enable the checkbox.