examples/preact/index.js
function findItemInDataForExpansion (label) {
    for (let i = 0; i < data.length; i++) {
        if (data[i].label === label) {
            let item = data[i];
            let offset = data.filter(d => d.parent === item.parent).findIndex(d => d.id === item.id);

            return {
                parent: item.parent,
                id: item.id,
                children: item.children,
                offset: offset
            };
        }
    }
}
function findItemInDataForExpansion (label) {
    for (let i = 0; i < data.length; i++) {
        if (data[i].label === label) {
            let item = data[i];
            let offset = data.filter(d => d.parent === item.parent).findIndex(d => d.id === item.id);

            return {
                parent: item.parent,
                id: item.id,
                children: item.children,
                offset: offset
            };
        }
    }
}
function findItemInDataForExpansion ( label ) { for ( let i = 0 ; i < data . length ; i ++ ) { if ( data [ i ] . label === label ) { let item = data [ i ] ; let offset = data . filter ( d => d . parent === item . parent ) . findIndex ( d => d . id === item . id ) ; return { parent : item . parent , id : item . id , children : item . children , offset : offset } ; } } }
Helper function for demo to dynamically expand items
Helper function for demo to dynamically expand items