How to use the react-sortable-tree.getTreeFromFlatData function in react-sortable-tree

To help you get started, we’ve selected a few react-sortable-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JithinKS97 / dynamic-learning / imports / ui / components / directories / SimsDirectories.jsx View on Github external
Tracker.autorun(() => {
      const simsHandle = Meteor.subscribe('sims');
      const loading = !simsHandle.ready();
      const flatData = Sims.find({ userId: Meteor.userId() }).fetch();
      const simsExists = !loading && !!flatData;

      const getKey = node => node._id;
      const getParentKey = node => node.parent_id;
      const rootKey = '0';

      const treeData = getTreeFromFlatData({
        flatData,
        getKey,
        getParentKey,
        rootKey,
      });

      this.setState({
        simsExists,
        treeData: simsExists ? treeData : [],
      });
    });
  }
github JithinKS97 / dynamic-learning / imports / ui / components / directories / LessonsDirectories.jsx View on Github external
this.lessonsTracker = Tracker.autorun(() => {
      const lessonsHandle = Meteor.subscribe('lessons');
      const loading = !lessonsHandle.ready();
      const flatData = Lessons.find({ userId: Meteor.userId() }).fetch();

      const getKey = node => node._id;
      const getParentKey = node => node.parent_id;
      const rootKey = '0';

      const treeData = getTreeFromFlatData({
        flatData,
        getKey,
        getParentKey,
        rootKey,
      });

      this.setState({
        treeData,
        loading,
      });
    });
  }
github JithinKS97 / dynamic-learning / imports / ui / components / LessonsDirectories.jsx View on Github external
this.lessonsTracker = Tracker.autorun(() => {


      const lessonsHandle = Meteor.subscribe('lessons')
      const loading = !lessonsHandle.ready()
      const flatData = Lessons.find({ userId: Meteor.userId() }).fetch()

      const getKey = node => node._id
      const getParentKey = node => node.parent_id
      const rootKey = '0'

      const treeData = getTreeFromFlatData({
        flatData,
        getKey,
        getParentKey,
        rootKey
      })

      this.setState({

        treeData,
        loading
      })
    })
  }
github nambrot / blockchain-in-js / src / components / BlockchainTree.js View on Github external
render() {
    const treeData = getTreeFromFlatData({
      flatData: Object.values(this.props.blockchain.blocks),
      getKey: block => block.hash,
      getParentKey: block => block.parentHash,
      rootKey: this.props.blockchain.genesis.parentHash
    });
    const longestChain = this.props.blockchain.longestChain();
    return (
      <div style="{{">
         this.setState({ treeData })}
          generateNodeProps={generateNodeProps(longestChain).bind(this)}
        /&gt;
        </div>
github JithinKS97 / dynamic-learning / imports / ui / components / LessonPlansDirectories.js View on Github external
export default LessonPlansDirectoriesContainer = withTracker(()=>{

    const lessonplansHandle = Meteor.subscribe('lessonplans')
    const loading = !lessonplansHandle.ready()
    const flatData = LessonPlans.find({userId: Meteor.userId()}).fetch()
    const lessonplansExists = !loading && !!flatData

    const getKey = node => node._id
    const getParentKey = node => node.parent_id
    const rootKey = '0'        

    const treeData = getTreeFromFlatData({
        flatData,
        getKey,
        getParentKey,
        rootKey
    })
 

    return {
        lessonplansExists,
        treeData
    }

})(LessonPlansDirectories)
github JithinKS97 / dynamic-learning / imports / ui / components / WorkbooksDirectories.jsx View on Github external
export default withTracker(() => {
  const workbooksHandle = Meteor.subscribe('workbooks');
  const loading = !workbooksHandle.ready();
  const flatData = Workbooks.find({ userId: Meteor.userId() }).fetch();
  const workbooksExists = !loading && !!flatData;

  const getKey = node => node._id;
  const getParentKey = node => node.parent_id;
  const rootKey = '0';

  const treeData = getTreeFromFlatData({
    flatData,
    getKey,
    getParentKey,
    rootKey,
  });


  return {
    workbooksExists,
    treeData,
  };
})(WorkbooksDirectories);