Skip to content

yjcxy12/react-treeview-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React tree component

Tree component for react

Demo (Also check out the src/example/ folder for usage).

Install

npm install react-treeview-component

Include js file at "react-treeview-component/build/react-tree.js"
Include css file at "react-treeview-component/build/react-tree.css"

Usage

Added to your react component

<Treeview dataSource={this.props.dataSource}
  onTreenodeClick={this.handleTreenodeClick}>
</Treeview>

API

Properties

dataSouce

{
  "id": "string"	// Unique identifier for the node
  "text": "string"  // Treenode display text
  "icon": "string"	// Custom icon, CSS class
  "opened": Bool,	// If the node is opened	
  "selected": Bool,	// If the node is selected
  "children": []	// Array of children nodes	
}

onTreenodeClick

######function (id, event)

  • id: node id
  • event: mouse clicked event

perform function on treenode clicked

Methods (Use though 'ref' property)

dfs

######function (callback)

  • callback: 1 parameter: node

perform depth first search on dataSource, applying callback on each node

bfs

######function (callback)

  • callback: 1 parameter: node

perform breadth first search on dataSource, applying callback on each node

License

MIT.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published