diff --git a/js/components/ascribe_table/table.js b/js/components/ascribe_table/table.js index 6ea5f07e..d95ea4c7 100644 --- a/js/components/ascribe_table/table.js +++ b/js/components/ascribe_table/table.js @@ -8,14 +8,15 @@ import TableColumnModel from '../../models/table_column_model'; let Table = React.createClass({ propTypes: { - columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnModel)) + columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnModel)), + changeOrder: React.PropTypes.func.isRequired }, render() { if(this.props.itemList && this.props.itemList.length > 0) { return (
- + {this.props.itemList.map((item, i) => { return ( diff --git a/js/components/ascribe_table/table_header.js b/js/components/ascribe_table/table_header.js index 3c959f76..853990bf 100644 --- a/js/components/ascribe_table/table_header.js +++ b/js/components/ascribe_table/table_header.js @@ -12,7 +12,7 @@ let TableHeader = React.createClass({ propTypes: { columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnModel)), itemList: React.PropTypes.array.isRequired, - fetchList: React.PropTypes.func.isRequired, + changeOrder: React.PropTypes.func.isRequired, orderAsc: React.PropTypes.bool.isRequired, orderBy: React.PropTypes.string.isRequired }, @@ -36,7 +36,7 @@ let TableHeader = React.createClass({ canBeOrdered={canBeOrdered} orderAsc={this.props.orderAsc} orderBy={this.props.orderBy} - fetchList={this.props.fetchList}> + changeOrder={this.props.changeOrder}> ); })} diff --git a/js/components/ascribe_table/table_header_item.js b/js/components/ascribe_table/table_header_item.js index d918f6e3..fef82f34 100644 --- a/js/components/ascribe_table/table_header_item.js +++ b/js/components/ascribe_table/table_header_item.js @@ -9,13 +9,13 @@ let TableHeaderItem = React.createClass({ displayName: React.PropTypes.string.isRequired, columnName: React.PropTypes.string.isRequired, canBeOrdered: React.PropTypes.bool.isRequired, + changeOrder: React.PropTypes.func.isRequired, orderAsc: React.PropTypes.bool.isRequired, - orderBy: React.PropTypes.string.isRequired, - fetchList: React.PropTypes.func.isRequired + orderBy: React.PropTypes.string.isRequired }, changeOrder() { - this.props.fetchList(1, 10, null, this.props.columnName, !this.props.orderAsc); + this.props.changeOrder(this.props.columnName, !this.props.orderAsc); }, render() { diff --git a/js/components/piece_list.js b/js/components/piece_list.js index 4fe55f2d..be3bfbe3 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -26,8 +26,11 @@ let PieceList = React.createClass({ }, paginationGoToPage(page) { - return () => PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, - this.state.orderBy, this.state.orderAsc); + return () => PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + }, + + tableChangeOrder(orderBy, orderAsc) { + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, orderBy, orderAsc); }, render() { @@ -46,7 +49,6 @@ let PieceList = React.createClass({ return { 'itemList': props.pieceList, 'itemListCount': props.pieceListCount, - 'fetchList': props.fetchPieceList, 'orderBy': props.orderBy, 'orderAsc': props.orderAsc, 'search': props.search, @@ -54,7 +56,7 @@ let PieceList = React.createClass({ 'pageSize': props.pageSize } }}> - +
);