mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Sort non-number columns ASCending by default.
- And number columns DESCending by default. - default: when you sort by that column for the first time.
This commit is contained in:
@@ -163,9 +163,11 @@ export default class NodeDetailsTable extends React.Component {
|
||||
|
||||
handleHeaderClick(ev, headerId) {
|
||||
ev.preventDefault();
|
||||
const sortedDesc = headerId === this.state.sortBy
|
||||
? !this.state.sortedDesc : this.state.sortedDesc;
|
||||
const sortBy = headerId;
|
||||
const header = this.getColumnHeaders().find(h => h.id === headerId);
|
||||
const defaultSortDesc = header.dataType === 'number';
|
||||
const sortedDesc = header.id === this.state.sortBy
|
||||
? !this.state.sortedDesc : defaultSortDesc;
|
||||
const sortBy = header.id;
|
||||
this.setState({sortBy, sortedDesc});
|
||||
this.props.onSortChange(sortBy, sortedDesc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user