Skip to content

Releases: cheton/infinite-tree

v1.12.5

16 Sep 14:35
Compare
Choose a tag to compare

Fixed IE compatibility issue (10e8749, #14)

v1.12.4

12 Aug 10:00
Compare
Choose a tag to compare

Adds an optional complete callback to the next function of the loadNodes option (62b11af)

loadNodes: (parentNode, next) => { // Load node on demand
    // Loading...
    const nodes = [];
    nodes.length = 1000;
    for (let i = 0; i < nodes.length; ++i) {
        nodes[i] = {
            id: `${parentNode.id}.${i}`,
            name: `${parentNode.name}.${i}`,
            loadOnDemand: true
        };
    }

    next(null, nodes, function() {
        // Complete callback
    });
}

v1.12.3

11 Aug 02:39
Compare
Choose a tag to compare

Bug Fixes

Resolve a critical performance issue when loading thousands nodes on-demand (faca827)

image

v1.12.2

31 Jul 07:10
Compare
Choose a tag to compare

Refines error message format (26d90bc)

v1.12.1

29 Jul 02:12
Compare
Choose a tag to compare

Defines the behavior for:

tree.filter(predicate, options)

Invalid predicate

Only a string or a function is accepted for the predicate parameter. For example, tree.filter(), tree.filter(null), tree.filter(0), or tree.filter({}) will render nothing.

Empty string

Calling tree.filter('') will filter all nodes in the tree.

v1.12.0

28 Jul 08:00
Compare
Choose a tag to compare

Improvements

How to filter nodes?

In your row renderer, returns undefined or an empty string to filter out unwanted nodes (i.e. node.state.filtered === false):

import tag from 'html5-tag';

const renderer = (node, treeOptions) => {
    if (node.state.filtered === false) {
        return;
    }

    // Do something

    return tag('div', treeNodeAttributes, treeNode);
};

The filter function accepts a keyword string, or a function to test each node of the tree. The function returns true to keep the node, false otherwise.

Filter by string
const keyword = 'text-to-filter';
const filterOptions = {
    caseSensitive: false,
    exactMatch: false,
    filterPath: 'props.name', // Defaults to 'name'
    includeAncestors: true,
    includeDescendants: true
};
tree.filter(keyword, filterOptions);
Filter by function
const keyword = 'text-to-filter';
const filterOptions = {
    includeAncestors: true,
    includeDescendants: true
};
tree.filter(function(node) {
    const name = node.name || '';
    return name.toLowerCase().indexOf(keyword) >= 0;
});
Turn off filter

Calls tree.unfilter() to turn off filter.

tree.unfilter();

v1.11.0

17 May 06:51
Compare
Choose a tag to compare

Events

Examples

  • Provides a multiple selection example using ctrl key or meta key (d98bc5d)

v1.10.0

06 Apr 04:03
Compare
Choose a tag to compare
  • Adds a new API getNodeFromPoint(x, y) that returns the node at the specified point (0bf17c6)
  • Fixed a bug that getNodeById should return a null value instead of an undefined value if the id doesn't match (725c32c)

v1.9.0

05 Apr 06:22
Compare
Choose a tag to compare

Functions: Tree

  • moveNodeTo(node, parentNode, index)
  • swapNodes(node1, node2)

v1.8.2

11 Mar 03:42
Compare
Choose a tag to compare

Refresh lookup table when changing the node id attribute with updateNode (fcf33cb, resolves #9)