0
django namedtuple
のテーブルを作成したいのですが、エラーが発生しました。ヘッダー(これはリストです)はうまく動作します。django namedtupleの反応テーブルが返されます.mapは関数ではありません
views.py
:Uncaught TypeError: this.props.tableContent.map is not a function
:
info = [Info(id=5, location_id=861, f=None),Info(id=3, location_id=650, f=None)]
return render('index.html', {'info': info})
index.html
var headers = ['id', 'location', 'f']
var Table = React.createClass({
render: function() {
return (
<table className="table-hover">
{this.props.headers.map(function(name, index) {
return <th key={ index }>{name}</th>;
})};
{this.props.tableContent.map(function(row, index) {
<tr key={index}>
return(
{row.map(function(col, i) {
<td key={i}>{col}</td>
})}
);
</tr>
})};
</table>
)
}
});
ReactDOM.render(
<Table headers={headers} tableContent={info}/>,
document.getElementById('content')
);
私は、任意の出力とコンソール言うを見ることができません。