Created
June 8, 2015 08:25
-
-
Save rundis/145cfdaf6ea277c9647b to your computer and use it in GitHub Desktop.
FixedDataTable with cellRenderer throws when using dev version of react
This file contains hidden or 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/5e72a326c16b667ec6f38cb47147c74daeaaf956/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/5e72a326c16b667ec6f38cb47147c74daeaaf956/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