Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
public/bower_components/
public/index.html
15 changes: 12 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<html>
<head>
<title>React.js Tree View <i>for Twitter Bootstrap</title>
<link href="./bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="./css/react-bootstrap-treeview.css" rel="stylesheet">
</head>
<body>
Expand All @@ -12,9 +20,10 @@ <h1>React.js Tree View <i>for Twitter Bootstrap</i></h1>
<div id="treeview"></div>
</div>
</div>
<script src="./bower_components/react/react.js"></script>
<script src="./bower_components/react/JSXTransformer.js"></script>
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
<script src="./js/react-bootstrap-treeview.js"></script>
<script type="text/jsx" src="./js/example.jsx"></script>

</body>
</html>
79 changes: 46 additions & 33 deletions public/js/example.jsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,54 @@


var data = [
{
text: 'Parent 1',
nodes: [
{
text: 'Child 1',
{
text: 'Parent 1',
id: '1',
nodes: [
{
text: 'Grandchild 1'
},
{
text: 'Grandchild 2'
}
{
text: 'Child 1',
id: '11',
nodes: [
{
text: 'Grandchild 1',
id: '111'
},
{
text: 'Grandchild 2',
id: '112'
}
]
},
{
text: 'Child 2',
id: '12'
}
]
},
{
text: 'Child 2'
}
]
},
{
text: 'Parent 2'
},
{
text: 'Parent 3'
},
{
text: 'Parent 4'
},
{
text: 'Parent 5'
}
},
{
text: 'Parent 2',
id: '2'
},
{
text: 'Parent 3',
id: '3'
},
{
text: 'Parent 4',
id: '4'
},
{
text: 'Parent 5'
}
];

var test = function () {
console.log('click');
}

React.render(
<TreeView data={data} color={"#428bca"} />,
document.getElementById('treeview')
<TreeView
data={data}
color={"#428bca"}
onLineClicked={test}
treeNodeAttributes={{'data-id':'id'}}/>,
document.getElementById('treeview')
);
Loading