Browse Source

sort desc tx history fix

all-modes
pbca26 8 years ago
parent
commit
fcde5b528c
  1. 12
      react/src/components/dashboard/walletsData.js
  2. 12
      react/src/components/dashboard/walletsNativeTxHistory.js

12
react/src/components/dashboard/walletsData.js

@ -151,13 +151,13 @@ class WalletsData extends React.Component {
} }
updateInput(e) { updateInput(e) {
let historyToSplit = this.props.ActiveCoin.txhistory; let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice(0, e.target.value); historyToSplit = historyToSplit.slice(0, e.target.value);
this.setState({ this.setState({
[e.target.name]: e.target.value, [e.target.name]: e.target.value,
activePage: 1, activePage: 1,
itemsList: sortByDate(historyToSplit), itemsList: historyToSplit,
}); });
} }
@ -168,11 +168,11 @@ class WalletsData extends React.Component {
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
if (this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory.length) { if (this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory.length) {
if (!this.state.itemsList || (this.state.itemsList && !this.state.itemsList.length) || (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) { if (!this.state.itemsList || (this.state.itemsList && !this.state.itemsList.length) || (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) {
let historyToSplit = this.props.ActiveCoin.txhistory; let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage); historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage);
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
itemsList: sortByDate(historyToSplit), itemsList: historyToSplit,
})); }));
} }
} }
@ -185,12 +185,12 @@ class WalletsData extends React.Component {
} }
updateCurrentPage(page) { updateCurrentPage(page) {
let historyToSplit = this.props.ActiveCoin.txhistory; let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice((page - 1) * this.state.itemsPerPage, page * this.state.itemsPerPage); historyToSplit = historyToSplit.slice((page - 1) * this.state.itemsPerPage, page * this.state.itemsPerPage);
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
activePage: page, activePage: page,
itemsList: sortByDate(historyToSplit), itemsList: historyToSplit,
})); }));
} }

12
react/src/components/dashboard/walletsNativeTxHistory.js

@ -26,13 +26,13 @@ class WalletsNativeTxHistory extends React.Component {
} }
updateInput(e) { updateInput(e) {
let historyToSplit = this.props.ActiveCoin.txhistory; let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice(0, e.target.value); historyToSplit = historyToSplit.slice(0, e.target.value);
this.setState({ this.setState({
[e.target.name]: e.target.value, [e.target.name]: e.target.value,
activePage: 1, activePage: 1,
itemsList: sortByDate(historyToSplit), itemsList: historyToSplit,
}); });
} }
@ -82,23 +82,23 @@ class WalletsNativeTxHistory extends React.Component {
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
if (!this.state.itemsList || (this.state.itemsList && !this.state.itemsList.length) || (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) { if (!this.state.itemsList || (this.state.itemsList && !this.state.itemsList.length) || (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) {
if (this.props.ActiveCoin.txhistory) { if (this.props.ActiveCoin.txhistory) {
let historyToSplit = this.props.ActiveCoin.txhistory; let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage); historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage);
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
itemsList: sortByDate(historyToSplit), itemsList: historyToSplit,
})); }));
} }
} }
} }
updateCurrentPage(page) { updateCurrentPage(page) {
let historyToSplit = this.props.ActiveCoin.txhistory; let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice((page - 1) * this.state.itemsPerPage, page * this.state.itemsPerPage); historyToSplit = historyToSplit.slice((page - 1) * this.state.itemsPerPage, page * this.state.itemsPerPage);
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
activePage: page, activePage: page,
itemsList: sortByDate(historyToSplit), itemsList: historyToSplit,
})); }));
} }

Loading…
Cancel
Save