1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 17:45:10 +01:00
onion/js/components/ascribe_table/table_header.js

51 lines
1.6 KiB
JavaScript
Raw Normal View History

'use strict';
2015-05-20 14:48:57 +02:00
import React from 'react';
2015-05-21 15:14:05 +02:00
import TableColumnMixin from '../../mixins/table_column_mixin';
2015-05-21 14:51:15 +02:00
import TableHeaderItem from './table_header_item';
2015-05-20 14:48:57 +02:00
import { ColumnModel } from './models/table_models';
2015-05-20 16:44:45 +02:00
2015-05-20 14:48:57 +02:00
let TableHeader = React.createClass({
propTypes: {
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(ColumnModel)),
2015-05-20 19:19:57 +02:00
itemList: React.PropTypes.array.isRequired,
changeOrder: React.PropTypes.func,
orderAsc: React.PropTypes.bool,
orderBy: React.PropTypes.string
2015-05-20 19:19:57 +02:00
},
mixins: [TableColumnMixin],
2015-05-20 14:48:57 +02:00
render() {
return (
2015-06-04 17:21:38 +02:00
<thead>
<tr>
{this.props.columnList.map((val, i) => {
2015-05-26 14:57:32 +02:00
let columnClasses = this.calcColumnClasses(this.props.columnList, i, 12);
let columnName = this.props.columnList[i].columnName;
let canBeOrdered = this.props.columnList[i].canBeOrdered;
2015-05-20 14:48:57 +02:00
return (
2015-05-21 14:51:15 +02:00
<TableHeaderItem
key={i}
columnClasses={columnClasses}
displayName={val.displayName}
columnName={columnName}
canBeOrdered={canBeOrdered}
2015-05-21 14:51:15 +02:00
orderAsc={this.props.orderAsc}
orderBy={this.props.orderBy}
changeOrder={this.props.changeOrder} />
2015-05-20 14:48:57 +02:00
);
})}
2015-06-04 17:21:38 +02:00
</tr>
</thead>
2015-05-20 14:48:57 +02:00
);
}
});
2015-05-20 16:44:45 +02:00
export default TableHeader;