All Projects → arixse → ztree-for-react

arixse / ztree-for-react

Licence: MIT license
jQuery zTreeV3.x 插件react封装

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to ztree-for-react

Data-Structure-Algorithm-Programs
This Repo consists of Data structures and Algorithms
Stars: ✭ 464 (+2009.09%)
Mutual labels:  tree
avl array
High performance templated AVL tree using a fixed size array. Extensive test suite passing.
Stars: ✭ 33 (+50%)
Mutual labels:  tree
vscode-gcode-syntax
G Code Language Extension for Visual Studio Code. Turn VSCode into a fully capable G-Code editor, including language support & more.
Stars: ✭ 59 (+168.18%)
Mutual labels:  tree
jquery-tree
jQuery-tree is a jQuery plugin to make an HTML unorder list (ul) in a tree.
Stars: ✭ 29 (+31.82%)
Mutual labels:  tree
beehive
A flexible, modern, header-only implementation of behavior trees
Stars: ✭ 37 (+68.18%)
Mutual labels:  tree
go-avltree
AVL tree with some useful extensions written in Go
Stars: ✭ 29 (+31.82%)
Mutual labels:  tree
data-structure-project
自己实现集合框架系列整理总结
Stars: ✭ 29 (+31.82%)
Mutual labels:  tree
android-thinkmap-treeview
Tree View; Mind map; Think map; tree map; custom view; 自定义;关系图;树状图;思维导图;组织机构图;层次图
Stars: ✭ 314 (+1327.27%)
Mutual labels:  tree
nub
A rendering and interaction Processing library
Stars: ✭ 28 (+27.27%)
Mutual labels:  tree
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (-18.18%)
Mutual labels:  tree
ng-treetable
A treetable module for angular 5
Stars: ✭ 32 (+45.45%)
Mutual labels:  tree
mongodb-tree-structure
Implementing Tree Structure in MongoDB
Stars: ✭ 14 (-36.36%)
Mutual labels:  tree
taxonium
A tool for exploring very large trees in the browser
Stars: ✭ 65 (+195.45%)
Mutual labels:  tree
vuejs-tree
A highly customizable and blazing fast Vue tree component ⚡🌲
Stars: ✭ 310 (+1309.09%)
Mutual labels:  tree
gtree
Output tree🌳 or Make directories📁 from #Markdown or Programmatically. Provide CLI, Golang library and Web (using #Wasm ).
Stars: ✭ 88 (+300%)
Mutual labels:  tree
react-vertical-tree
Simple & lightweight vertical tree like view.
Stars: ✭ 23 (+4.55%)
Mutual labels:  tree
un-flatten-tree
A small npm module for converting trees to lists and vice versa.
Stars: ✭ 14 (-36.36%)
Mutual labels:  tree
LoveTree
🌴爱情树,将相爱的时刻永远珍藏 (微信,QQ可完美查看)https://ajlovechina.github.io/LoveTree/
Stars: ✭ 295 (+1240.91%)
Mutual labels:  tree
BBob
⚡️Blazing-fast js-bbcode-parser, bbcode js, that transforms and parses to AST with plugin support in pure javascript, no dependencies
Stars: ✭ 133 (+504.55%)
Mutual labels:  tree
mcts
🌳 Domain independent implementation of Monte Carlo Tree Search methods.
Stars: ✭ 15 (-31.82%)
Mutual labels:  tree

ztree-for-react

Build Status DUB

对jQuery zTreeV3.x 插件做react封装

install

npm install ztree-for-react --save-dev

useage

import React,{Component} from 'react';
import ReactZtree from 'ztree-for-react';
const nodes= [
	{name: "父节点1",
    id:0,
     children: [
		{name: "子节点1",
    id:1},
		{name: "子节点2",id:2,children:[
      {name:"子节点3",id:3}
    ]}
	]}
];
export default class App extends Component {
  render() {
    return (
      <div>
          <ReactZtree nodes={nodes} events={this.getEvents()} check={check} ref="ztree" treeName={'tree1'}/>
          <ReactZtree nodes={nodes} events={this.getEvents()} check={check} ref="ztree"/>
      </div>
    );
  }
  getEvents(){
    return {
      'onClick':(event,treeId,treeNode)=>{this.handleClick(event,treeId,treeNode)},
      'onCheck':(event,treeId,treeNode)=>{this.handleClick(event,treeId,treeNode)}
    }
  }
  handleClick(event,treeId,treeNode){
    console.log(treeNode);
    console.log(this.refs.ztree.ztreeObj.getCheckedNodes());
  }
  handleCheck(event,treeId,treeNode){
    console.log(treeNode);
  }
  componentDidMount(){
    //you can add treeName prop to set this treeObj to the window 
    console.log(window.ztree);
    /**
     * 
     * {tree1: {}}
        tree1
        :
        {setting: {}, addNodes: ƒ, cancelSelectedNode: ƒ, destroy: ƒ, expandAll: ƒ,}
        __proto__
        :
        Object
     * /
  }
}

quick start

npm install

npm start

open http://127.0.0.1:3000 in you browser

component props

  • treeName (string) the global attribute name
  • nodes (required, object) the zTreee Nodes data
  • events (object) the zTree Nodes event(the zTree callback setting)
  • async (object) to load zTree Nodes as async(the zTree async setting)
  • check (object) the zTree check setting(the zTree check setting)
  • data (object) the zTree data setting
  • edit (object) the zTree eidt setting
  • view (object) the zTree view setting

please go jQuery zTree to get more infomations!

FAQ

1. jQuery is not defined?

Please install expose-loader,and add some config to your webpack config 😄

module: {
    loaders: [{
      test:require.resolve('jquery'),
      loader:'expose?jQuery!expose?$'
    }]
  }

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].