当前位置: 首页 > 工具软件 > Fancytree > 使用案例 >

fancyTree学习笔记

方波娃
2023-12-01
PS:学习并使用Fancytree控件过程中,通过阅读官方指导文档发现的该控件节点的可配置内容及其它常用的、方便使用的节点操作的API。

一.Fancytree控件节点的可配置项如下:


$("#selector").fancytree({
    activeVisible: true, // Make sure, active nodes are visible (expanded)
    aria: true, // Enable WAI-ARIA support
    autoActivate: true, // Automatically activate a node when it is focused using keyboard
    autoCollapse: false, // Automatically collapse all siblings, when a node is expanded
    autoScroll: false, // Automatically scroll nodes into visible area
    clickFolderMode: 4, // 1:activate, 2:expand, 3:activate and expand, 4:activate (dblclick expands)
    checkbox: false, // Show checkboxes
    debugLevel: 2, // 0:quiet, 1:normal, 2:debug
    disabled: false, // Disable control
    focusOnSelect: false, // Set focus when node is checked by a mouse click
    escapeTitles: false, // Escape `node.title` content for display
    generateIds: false, // Generate id attributes like <span id='fancytree-id-KEY'>
    idPrefix: "ft_", // Used to generate node id´s like <span id='fancytree-id-<key>'>
    icon: true, // Display node icons
    keyboard: true, // Support keyboard navigation
    keyPathSeparator: "/", // Used by node.getKeyPath() and tree.loadKeyPath()
    minExpandLevel: 1, // 1: root node is not collapsible
    quicksearch: false, // Navigate to next node by typing the first letters
    rtl: false, // Enable RTL (right-to-left) mode
    selectMode: 2, // 1:single, 2:multi, 3:multi-hier
    tabindex: "0", // Whole tree behaves as one single control
    titlesTabbable: false, // Node titles can receive keyboard focus
    tooltip: false // Use title as tooltip (also a callback could be specified)
});


二.设置节点 Selected属性:

Use `node.setSelected()` or `node.isSelected()` to access.


三.设置节点title属性

title Node text (may contain HTML tags). Use `node.setTitle()` to modify.


{$.Promise} reload(source)  重新加载节点源


四.节点方法:根据键值获取节点

{FancytreeNode|null} getNodeByKey(key, searchRoot)

Return node with a given key or null if not found.
Parameters:
Name Type Argument Description
key string
searchRoot FancytreeNode
<optional> only search below this node
Returns:
Type
FancytreeNode | null


 类似资料: