add defaultOrder field to tablecard header

This commit is contained in:
Ron Rennick 2019-04-30 15:11:30 -03:00
parent 2aaf0ee4b5
commit c48fc40b11
1 changed files with 5 additions and 1 deletions

View File

@ -116,7 +116,7 @@ class Table extends Component {
'is-scrollable': isScrollable, 'is-scrollable': isScrollable,
} ); } );
const sortedBy = query.orderby || get( find( headers, { defaultSort: true } ), 'key', false ); const sortedBy = query.orderby || get( find( headers, { defaultSort: true } ), 'key', false );
const sortDir = query.order || DESC; const sortDir = query.order || get( find( headers, { key: sortedBy } ), 'defaultOrder', DESC );
return ( return (
<div <div
@ -248,6 +248,10 @@ Table.propTypes = {
* Boolean, true if this column is the default for sorting. Only one column should have this set. * Boolean, true if this column is the default for sorting. Only one column should have this set.
*/ */
defaultSort: PropTypes.bool, defaultSort: PropTypes.bool,
/**
* String, asc|desc if this column is the default for sorting. Only one column should have this set.
*/
defaultOrder: PropTypes.string,
/** /**
* Boolean, true if this column should be aligned to the left. * Boolean, true if this column should be aligned to the left.
*/ */