2015-05-20 11:16:42 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import TableItem from './table_item';
|
2015-05-20 14:48:57 +02:00
|
|
|
import TableHeader from './table_header';
|
2015-05-20 11:16:42 +02:00
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
|
2015-05-20 11:16:42 +02:00
|
|
|
let Table = React.createClass({
|
2015-05-20 14:48:57 +02:00
|
|
|
propTypes: {
|
|
|
|
columnMap: React.PropTypes.object.isRequired
|
|
|
|
},
|
2015-05-20 11:16:42 +02:00
|
|
|
render() {
|
2015-05-20 14:48:57 +02:00
|
|
|
if(this.props.itemList && this.props.itemList.length > 0) {
|
|
|
|
return (
|
2015-05-20 17:32:06 +02:00
|
|
|
<div className="ascribe-table">
|
2015-05-21 14:03:56 +02:00
|
|
|
<TableHeader columnMap={this.props.columnMap} itemList={this.props.itemList} fetchList={this.props.fetchList} orderAsc={this.props.orderAsc} orderBy={this.props.orderBy} />
|
2015-05-20 14:48:57 +02:00
|
|
|
{this.props.itemList.map((item, i) => {
|
|
|
|
return (
|
|
|
|
<TableItem columnMap={this.props.columnMap} columnContent={item} key={i} />
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<p>Loading</p>
|
|
|
|
);
|
|
|
|
}
|
2015-05-20 11:16:42 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-05-20 12:00:16 +02:00
|
|
|
export default Table;
|