From 6f01f83c96cbd79b5b24d4f9b74942a18f146149 Mon Sep 17 00:00:00 2001 From: Alec Clowes Date: Fri, 23 Sep 2016 13:02:36 -0700 Subject: [PATCH] use helper function to get sortDirection when useExternal is true --- scripts/griddle.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/griddle.jsx b/scripts/griddle.jsx index f3318bbc..35e07f98 100755 --- a/scripts/griddle.jsx +++ b/scripts/griddle.jsx @@ -612,6 +612,9 @@ var Griddle = React.createClass({ getCurrentSortAscending: function(){ return this.props.useExternal ? this.props.externalSortAscending : this.state.sortDirection === 'asc'; }, + getCurrentSortDirection: function getCurrentSortDirection() { + return this.props.useExternal ? (this.props.externalSortAscending ? 'asc' : 'desc') : this.state.sortDirection; + }, getCurrentMaxPage: function(){ return this.props.useExternal ? this.props.externalMaxPage : this.state.maxPage; }, @@ -622,7 +625,7 @@ var Griddle = React.createClass({ changeSort: this.changeSort, sortColumn: this.getCurrentSort(), sortAscending: this.getCurrentSortAscending(), - sortDirection: this.state.sortDirection, + sortDirection: this.getCurrentSortDirection(), sortAscendingClassName: this.props.sortAscendingClassName, sortDescendingClassName: this.props.sortDescendingClassName, sortAscendingComponent: this.props.sortAscendingComponent,