UNPKG

jquery.fancytree

Version:

jQuery tree view / tree grid plugin with support for keyboard, inline editing, filtering, checkboxes, drag'n'drop, and lazy loading

135 lines (122 loc) 3.88 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Fancytree - Example: font-awesome</title> <link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"> <script src="//code.jquery.com/jquery-3.2.1.min.js"></script> <script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <link href="../src/skin-awesome/ui.fancytree.css" rel="stylesheet" class="skinswitcher"> <script src="../src/jquery.fancytree.js"></script> <script src="../src/jquery.fancytree.glyph.js"></script> <!-- Start_Exclude: This block is not part of the sample code --> <link href="../lib/prettify.css" rel="stylesheet"> <script src="../lib/prettify.js"></script> <link href="../demo/sample.css" rel="stylesheet"> <script src="../demo/sample.js"></script> <style type="text/css"> ul.fancytree-container { /*font-size: 2em;*/ } </style> <!-- End_Exclude --> <!-- Add code to initialize the tree when the document is loaded: --> <script type="text/javascript"> $(function(){ // Initialize Fancytree $("#tree").fancytree({ extensions: ["glyph"], checkbox: true, selectMode: 3, glyph: { map: { doc: "fa fa-file-o", docOpen: "fa fa-file-o", checkbox: "fa fa-square-o", checkboxSelected: "fa fa-check-square-o", checkboxUnknown: "fa fa-square", dragHelper: "fa fa-arrow-right", dropMarker: "fa fa-long-arrow-right", error: "fa fa-warning", expanderClosed: "fa fa-caret-right", expanderLazy: "fa fa-angle-right", expanderOpen: "fa fa-caret-down", folder: "fa fa-folder-o", folderOpen: "fa fa-folder-open-o", loading: "fa fa-spinner fa-pulse" } }, source: {url: "ajax-tree-taxonomy.json", debugDelay: 1000}, lazyLoad: function(event, ctx) { ctx.result = {url: "ajax-sub2.json", debugDelay: 1000}; } }); }); </script> <!-- Start_Exclude: This block is not part of the sample code --> <script> $(function(){ // Adjust skinswitcher for current folder layout function setSize(event, ui){ $("#tree .fancytree-container").css("font-size", ui.value + "pt"); $("#curSize").text(ui.value + " pt"); } $( "#fontSlider" ).slider({ min: 4, max: 64, value: 10, change: setSize, slide: setSize }).slider("value", 10); /* $("#skinswitcher") // .skinswitcher("option", "base", "../../src/") .skinswitcher("addChoices", [ {name: "Awesome", value: "awesome", href: "skin-awesome/ui.fancytree.css"} ]) .skinswitcher("change", "awesome"); */ /* addSampleButton({ label: "Generate <input> elements", code: function(){ $("#tree").fancytree("getTree").generateInput(); $("#tree2").fancytree("getTree").generateInput(); } }); */ }); </script> <!-- End_Exclude --> </head> <body class="example"> <h1>Example: 'glyph' extension with font-awesome theme</h1> <div class="description"> <p> The 'glyph' extension adds <code>fa-...</code> classes to the node's <code>span</code> tags, so scalable vector icons as provided by <a href="http://fontawesome.io/" class="external" target="_blank">Font Awesome</a> can be used. </p> </div> <hr> Font size: <span id="curSize"></span> <div id="fontSlider"></div> <hr> <div id="tree"> </div> <!-- Start_Exclude: This block is not part of the sample code --> <p id="sampleButtons"> </p> <hr> <p class="sample-links no_code"> <a class="hideInsideFS" href="https://github.com/mar10/fancytree/">Fancytree project home</a> <a class="hideOutsideFS" href="#">Link to this page</a> <a class="hideInsideFS" href="index.html">Example Browser</a> <a href="#" id="codeExample">View source code</a> </p> <pre id="sourceCode" class="prettyprint" style="display:none"></pre> <!-- End_Exclude --> </body> </html>