Created
June 10, 2015 20:41
-
-
Save ehzhang/daf4453df43a4dede3d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="https://rawgit.com/facebook/fixed-data-table/v0.3.0/dist/fixed-data-table.css"> | |
</head> | |
<div id="content"></div> | |
<body> | |
<!-- The none minified version of react throws: | |
Uncaught TypeError: Cannot call method 'hasOwnProperty' of undefined | |
in checkAndWarnForMutatedProps | |
--> | |
<!-- // <script type="text/javascript" src="https://fb.me/react-with-addons-0.13.3.js"></script> --> | |
<!-- Using the minified version works like a champ though --> | |
<script type="text/javascript" src="https://fb.me/react-with-addons-0.13.3.min.js"></script> | |
<script type="text/javascript" src="https://rawgit.com/facebook/fixed-data-table/v0.3.0/dist/fixed-data-table.js"></script> | |
<script> | |
var data = [{col1: "Row1Col1", col2: "Row1Col2"}, | |
{col1: "Row2Col2", col2: "Row2Col2"}]; | |
var Table = FixedDataTable.Table; | |
var Column = FixedDataTable.Column; | |
function rowGetter(rowIndex) { | |
return data[rowIndex]; | |
} | |
function col2Renderer (v) { | |
return React.DOM.h1({}, v); | |
}; | |
var col1 = React.createElement( | |
Column, {label: "Col1", | |
width: 250, | |
dataKey: "col1"} | |
); | |
var col2 = React.createElement( | |
Column, {label: "Col2", | |
width: 250, | |
dataKey: "col2", | |
cellRenderer: col2Renderer} | |
); | |
var myTable = React.createElement( | |
Table, {rowHeight: 50, | |
rowGetter: rowGetter, | |
rowsCount: data.length, | |
width: 500, | |
height: 500, | |
headerHeight: 50}, col1, col2); | |
React.render(myTable, document.getElementById('content')); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment