@@ -15,31 +15,43 @@ Demo: http://cheton.github.io/react-infinite-tree
1515* A rich set of [ APIs] ( https://github.com/cheton/infinite-tree#api-documentation )
1616
1717## Browser Support
18- ![ Chrome] ( https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png ) <br >Chrome | ![ Edge] ( https://raw.github.com/alrra/browser-logos/master/edge/edge_48x48.png ) <br >Edge | ![ Firefox] ( https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png ) <br >Firefox | ![ IE] ( https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png ) <br >IE |
19- ![ Opera] ( https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png ) <br >Opera | ![ Safari] ( https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png ) <br >Safari
18+ ![ Chrome] ( https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png ) <br >Chrome | ![ Edge] ( https://raw.github.com/alrra/browser-logos/master/edge/edge_48x48.png ) <br >Edge | ![ Firefox] ( https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png ) <br >Firefox | ![ IE] ( https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png ) <br >IE | ![ Opera] ( https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png ) <br >Opera | ![ Safari] ( https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png ) <br >Safari
2019--- | --- | --- | --- | --- | --- |
2120 Yes | Yes | Yes| 9+ | Yes | Yes |
2221
23- ## Notice
24- <i >The project is under heavy development and a lot of things are changing. Stay tuned for further updates.</i >
25-
2622## Installation
2723``` bash
2824npm install --save react react-dom infinite-tree
2925npm install --save react-infinite-tree
3026```
3127
32- ## Usage
28+ ## Example
3329``` jsx
3430import React from ' react' ;
3531import InfiniteTree from ' react-infinite-tree' ;
3632import ' react-infinite-tree/dist/react-infinite-tree.css' ;
3733
34+ const data = {
35+ id: ' fruit' ,
36+ label: ' Fruit' ,
37+ children: [{
38+ id: ' apple' ,
39+ label: ' Apple'
40+ }, {
41+ id: ' banana' ,
42+ label: ' Banana' ,
43+ children: [{
44+ id: ' cherry' ,
45+ label: ' Cherry' ,
46+ loadOnDemand: true
47+ }]
48+ }]
49+ };
50+
3851class App extends React .Component {
3952 tree = null ;
4053
4154 componentDidMount () {
42- const data = generateData ();
4355 this .tree .loadData (data);
4456
4557 // Select the first node
@@ -68,8 +80,8 @@ class App extends React.Component {
6880 done (null , nodes);
6981 }, 1000 );
7082 }}
71- selectable= {true } // Defaults to true
72- shouldSelectNode= {(node ) => { // Defaults to null
83+ selectable= {true }
84+ shouldSelectNode= {(node ) => {
7385 if (! node || (node === this .tree .getSelectedNode ())) {
7486 return false ; // Prevent from deselecting the current node
7587 }
@@ -103,7 +115,7 @@ class App extends React.Component {
103115
104116## API Documentation
105117
106- Check out API documentation from [ infinite-tree] ( https://github.com/cheton/infinite-tree/wiki ) :
118+ Check out API documentation at [ infinite-tree] ( https://github.com/cheton/infinite-tree/wiki ) :
107119
108120* [ Options] ( https://github.com/cheton/react-infinite-tree/wiki/Options )
109121* [ Functions: Tree] ( https://github.com/cheton/react-infinite-tree/wiki/Functions:-Tree )
0 commit comments