Fix default list sorting (#5303)
* Fix default sorting for lists views * Linting
This commit is contained in:
parent
8a664c524c
commit
d99aa3192c
@ -47,7 +47,9 @@ export default class SortStore {
|
|||||||
@action restoreSavedOrder = () => {
|
@action restoreSavedOrder = () => {
|
||||||
const order = this.getSavedOrder();
|
const order = this.getSavedOrder();
|
||||||
|
|
||||||
this.onChange(order);
|
if (order) {
|
||||||
|
this.onChange(order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSavedOrder = () => {
|
getSavedOrder = () => {
|
||||||
|
@ -66,7 +66,7 @@ class Contracts extends Component {
|
|||||||
state = {
|
state = {
|
||||||
addContract: false,
|
addContract: false,
|
||||||
deployContract: false,
|
deployContract: false,
|
||||||
sortOrder: 'blockNumber',
|
sortOrder: 'blockNumber:-1',
|
||||||
searchValues: [],
|
searchValues: [],
|
||||||
searchTokens: []
|
searchTokens: []
|
||||||
}
|
}
|
||||||
@ -121,18 +121,16 @@ class Contracts extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderSortButton () {
|
renderSortButton () {
|
||||||
const onChange = (sortOrder) => {
|
const { sortOrder } = this.state;
|
||||||
this.setState({ sortOrder });
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionbarSort
|
<ActionbarSort
|
||||||
key='sortAccounts'
|
key='sortAccounts'
|
||||||
id='sortContracts'
|
id='sortContracts'
|
||||||
order={ this.state.sortOrder }
|
order={ sortOrder }
|
||||||
metas={ META_SORT }
|
metas={ META_SORT }
|
||||||
showDefault={ false }
|
showDefault={ false }
|
||||||
onChange={ onChange }
|
onChange={ this.handleSortChange }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -239,6 +237,10 @@ class Contracts extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSortChange = (sortOrder) => {
|
||||||
|
this.setState({ sortOrder });
|
||||||
|
}
|
||||||
|
|
||||||
onAddSearchToken = (token) => {
|
onAddSearchToken = (token) => {
|
||||||
const { searchTokens } = this.state;
|
const { searchTokens } = this.state;
|
||||||
const newSearchTokens = uniq([].concat(searchTokens, token));
|
const newSearchTokens = uniq([].concat(searchTokens, token));
|
||||||
|
Loading…
Reference in New Issue
Block a user