Skip to content

Instantly share code, notes, and snippets.

@ehzhang
Created June 10, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehzhang/daf4453df43a4dede3d8 to your computer and use it in GitHub Desktop.
Save ehzhang/daf4453df43a4dede3d8 to your computer and use it in GitHub Desktop.
<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