From fc47d4f258e79d40dc2d3072ed887d4a4aea9cbe Mon Sep 17 00:00:00 2001 From: Gary Menzel Date: Thu, 16 Nov 2017 03:05:44 +1100 Subject: [PATCH] Introduced a 'multiSort' flag Defaults to 'true' A 'false' value will turn multi-sort off. --- README.md | 4 +++ docs/src/App.js | 4 +++ docs/src/examples/expander/index.js | 54 +++++++++++++++++++++++++++++ src/defaultProps.js | 1 + src/index.js | 3 +- 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 docs/src/examples/expander/index.js diff --git a/README.md b/README.md index 7778e92..93ce030 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,7 @@ These are all of the available props (and their default values) for the main ` + • + + ) + } +} + +class SubComponent extends React.Component { + render() + { + return
Nothing
+ } +} + +export default class ComponentTest extends React.Component { + render() + { + const rtProps = { + data, + columns, + ExpanderComponent: (props)=>, + SubComponent: (props)=>, + multiSort: false, + } + return ( + + ) + } +} diff --git a/src/defaultProps.js b/src/defaultProps.js index 46f8962..838c7f2 100644 --- a/src/defaultProps.js +++ b/src/defaultProps.js @@ -22,6 +22,7 @@ export default { collapseOnDataChange: true, freezeWhenExpanded: false, sortable: true, + multiSort: true, resizable: true, filterable: false, defaultSortDesc: false, diff --git a/src/index.js b/src/index.js index b3d26f1..03bec8f 100644 --- a/src/index.js +++ b/src/index.js @@ -80,6 +80,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) { loadingText, noDataText, sortable, + multiSort, resizable, filterable, // Pivoting State @@ -382,7 +383,7 @@ export default class ReactTable extends Methods(Lifecycle(Component)) { maxWidth: _.asPx(maxWidth), }} toggleSort={e => { - isSortable && this.sortColumn(column, e.shiftKey) + isSortable && this.sortColumn(column, multiSort ? e.shiftKey : false) }} {...rest} >