forked from glittershark/reactable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
48 lines (41 loc) · 1.58 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-dom.js"></script>
<script src="http://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="build/reactable.js" type="text/javascript"></script>
<script type="text/jsx">
/** @jsx React.DOM */
var Table = Reactable.Table,
Thead = Reactable.Thead,
Th = Reactable.Th,
Tr = Reactable.Tr,
Td = Reactable.Td,
unsafe = Reactable.unsafe;
class CustomCell extends React.Component {
handleClick(){
alert(this.props.data);
}
render() {
if (this.props.data) {
return <a href={this.props.rowData.site.url}>{this.props.data.name}</a>;
} else {
return null;
}
}
}
ReactDOM.render(
<Table className="table" columnFormatters={ { 'site': CustomCell } } id="table" data={[
{ Name: 'Griffin Smith', Age: '18'},
{ Age: '28', Name:'Aaron Lisman', site:{ name:'www.aaronlisman.com', url:"http://www.aaronlisman.com" } },
{ Age: '23', Name:'Lee Salminen' },
]} sortable={['Name','Age']} filterable={['Name','Age','site']} />,
document.getElementById('test-div')
);
</script>
</head>
<body>
<div id="test-div"></div>
</body>
</html>