mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Add dynamically injectable TableItems to Table Component
This commit is contained in:
parent
486f058cb8
commit
47dd322cff
@ -1,17 +1,19 @@
|
||||
import React from 'react';
|
||||
|
||||
import TableItem from './table_item';
|
||||
import TableHeader from './table_header';
|
||||
|
||||
import TableColumnModel from '../../models/table_column_model';
|
||||
|
||||
|
||||
let Table = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnModel)),
|
||||
changeOrder: React.PropTypes.func.isRequired
|
||||
changeOrder: React.PropTypes.func.isRequired,
|
||||
tableItem: React.PropTypes.any.isRequired // Optimally, this should check if tableItem is an instance of React.Component or something like that
|
||||
},
|
||||
|
||||
render() {
|
||||
let TableItem = this.props.tableItem;
|
||||
|
||||
if(this.props.itemList && this.props.itemList.length > 0) {
|
||||
return (
|
||||
|
@ -5,6 +5,7 @@ import PieceListStore from '../stores/piece_list_store';
|
||||
import PieceListActions from '../actions/piece_list_actions';
|
||||
|
||||
import Table from './ascribe_table/table';
|
||||
import TableItem from './ascribe_table/table_item';
|
||||
import TableItemImg from './ascribe_table/table_item_img';
|
||||
import TableItemText from './ascribe_table/table_item_text';
|
||||
|
||||
@ -56,7 +57,8 @@ let PieceList = React.createClass({
|
||||
'pageSize': props.pageSize
|
||||
}
|
||||
}}>
|
||||
<Table columnList={columnList} changeOrder={this.tableChangeOrder} />
|
||||
<Table columnList={columnList} changeOrder={this.tableChangeOrder} tableItem={TableItem}>
|
||||
</Table>
|
||||
<Pagination currentPage={this.props.query.page} goToPage={this.paginationGoToPage} />
|
||||
</AltContainer>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user