Fancytree
repository·master·Indexed 25 days ago
https://github.com/mar10/fancytreeA feature-rich JavaScript tree view and tree grid plugin supporting keyboard navigation, inline editing, filtering, checkboxes, drag'n'drop, and lazy loading. Version 2.38.6-0 includes extensions for column view and drag-and-drop functionality, and provides support for ES6 modules and custom skinning.
What's inside jquery.fancytree
- The Taxonomy Browser is a demonstration application built using Fancytree. It showcases how Fancytree can be integrated with other libraries to create a functional taxonomy navigation interface.
Overview of Fancytree features
masterFancytree is a JavaScript tree view and tree grid plugin. Key features include:
- Keyboard navigation
- Inline editing
- Filtering
- Checkboxes
- Drag'n'drop
- Lazy loading
Understand the customized jQuery UI dependencies for Fancytree
masterFancytree uses a customized build of jQuery UI that includes only the widgets minimally required for its operation. This reduces bundle size and avoids conflicts with other jQuery UI instances.
The required widgets included in this build are:
widget.jsposition.jskeycode.jsscroll-parent.jsunique-id.js
Quickstart Fancytree with ES6 modules
masterTo use Fancytree in a modern ES6 environment, import jQuery, the desired skin (CSS or LESS), the
createTreefunction, and any specific modules you need (such aseditorfilter). Initialize the tree by callingcreateTreeon a selector with a configuration object specifying theextensionsandsourcedata.Note: Loading and initialization may be asynchronous, meaning nodes might not be immediately accessible after the call.
import $ from "jquery"; import 'jquery.fancytree/dist/skin-lion/ui.fancytree.less'; // CSS or LESS import {createTree} from 'jquery.fancytree'; import 'jquery.fancytree/dist/modules/jquery.fancytree.edit'; import 'jquery.fancytree/dist/modules/jquery.fancytree.filter'; const tree = createTree('#tree', { extensions: ['edit', 'filter'], source: {...}, ... });Dependencies for the Taxonomy Browser demo
masterTo run or build upon the Taxonomy Browser demo, the following libraries are required:
- jQuery
- Bootstrap.js
- Handlebars.js
- Fancytree
Initialize the Super Theme Switcher plugin
masterTo use the Super Theme Switcher, call the
.themeswitcher()method on a jQuery selector. All configuration options are optional, so you can initialize it with no arguments for default behavior.// Basic initialization with options $('#switcher').themeswitcher({ imgpath: "images/", loadTheme: "dot-luv" }); // Minimal initialization using defaults $('#switcher').themeswitcher();Update the jQuery UI dependencies
masterIf you need to update the customized jQuery UI dependencies used by Fancytree, follow these steps:
- Download new versions of the required widgets from https://jqueryui.com/.
- Apply the necessary modifications (replacing UMD headers with IIFE wrappers for
jquery-ui-iife.jsand applying the widget-protection patch forjquery.fancytree.ui-deps.js). - Run
grunt buildto test the changes.
Create a custom skin for Fancytree
masterTo create a custom skin, follow these steps:
- Create a new folder for your skin (e.g.,
src/skin-custom-...). - Copy the following files from an existing skin folder (e.g.,
src/skin-...) into your new folder to use as a base:ui.fancytree.less(Required)icons.gif(If your skin uses custom icons)loading.gif(If your skin uses a custom loading animation)
- Navigate to the root
fancytreedirectory in your terminal. - Run the development server using Grunt to enable automatic CSS generation.
- Edit your
ui.fancytree.lessfile. Theui.fancytree.cssfile will be automatically generated and updated whenever you save changes to the LESS file.
Prerequisites:
- NPM and Grunt must be installed on your system.
- Create a new folder for your skin (e.g.,
Upgrade recommendation: Wunderbaum
masterFancytree is considered feature-complete. While it is still maintained for bugfixes, no new major features are expected. For a more modernized and capable alternative, consider upgrading to Wunderbaum.Regenerate OpenSans typeface fonts
masterThe default template uses the OpenSans typeface. If you need to regenerate the font files, follow these steps using Font Squirrel:
- Open the OpenSans page at Font Squirrel.
- Click on the 'Webfont Kit' tab.
- Select a subset: use 'Western Latin (Default)' or select 'No Subsetting' if more glyphs are required.
- Click 'DOWNLOAD @FONT-FACE KIT'.
- For every typeface variant used, copy the
.eot,.svg, and.wofffiles into thetemplates/default/static/fontsdirectory.
Configure Super Theme Switcher options
masterThe
.themeswitcher()method accepts an options object to customize the theme selection interface.Option Type Description imgPathString Path to the image directory where theme icons are located. roundedBoolean If true, applies rounded corners to the themeswitcher link and dropdown. themesArray<Object> An array of theme objects that will override the default themes. additionalThemesArray<Object> An array of theme objects that will be included along with the default themes. jqueryUiVersionString The jQuery UI version of the themes. Default themes are linked from Google CDN. themePathString Base path to where the jQuery UI CSS themes are located. Default is Google CDN. Theme Object Format: When providing themes via
themesoradditionalThemes, use the following structure:{ title: "My theme", name: "my-theme", icon: "my-icon.png", url: "http://url-to-my-css-file.css" }Use the Column View extension
masterThe
columnviewextension allows Fancytree to render like a Mac Finder's column view. It transforms a standard Fancytree into a multi-column table layout where each level of the tree hierarchy is displayed in a subsequent table column.Requirements
- The target element must be a
<table>with at least two columns. - You must not use the
ext-tableextension simultaneously withcolumnview.
Behavior
- Navigation: Uses arrow keys to navigate between columns and nodes.
Rightmoves to the first child (or an expanded child),Leftmoves to the parent, andUp/Downmoves between siblings. - Automatic Configuration: When enabled, the extension forces
autoCollapse: true,toggleEffect: false, andclickFolderMode: 1to ensure smooth column transitions.
- The target element must be a