From 15a55030a27831a511643c713c98b82bceea09f0 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sun, 26 Aug 2018 13:12:30 +0800 Subject: [PATCH 1/2] fix #501 --- packages/react-bootstrap-table2/src/store/sort.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-bootstrap-table2/src/store/sort.js b/packages/react-bootstrap-table2/src/store/sort.js index ecbfbd7..dd2fd21 100644 --- a/packages/react-bootstrap-table2/src/store/sort.js +++ b/packages/react-bootstrap-table2/src/store/sort.js @@ -24,7 +24,7 @@ export const sort = (data, sortOrder, { dataField, sortFunc }) => { valueB = _.isDefined(valueB) ? valueB : ''; if (sortFunc) { - result = sortFunc(valueA, valueB, sortOrder, dataField); + result = sortFunc(valueA, valueB, sortOrder, dataField, a, b); } else { if (sortOrder === Const.SORT_DESC) { result = comparator(valueA, valueB); From c633e95e010679cb8dc1b9832e9380524501228a Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sun, 26 Aug 2018 13:21:31 +0800 Subject: [PATCH 2/2] patch docs for #501 --- docs/columns.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/columns.md b/docs/columns.md index 330b7ad..d472e67 100644 --- a/docs/columns.md +++ b/docs/columns.md @@ -121,15 +121,15 @@ It's only used for [`column.formatter`](#formatter), you can define any value fo Enable the column sort via a `true` value given. ## column.sortFunc - [Function] -`column.sortFunc` only work when `column.sort` is enable. `sortFunc` allow you to define your sorting algorithm. This callback function accept four arguments: +`column.sortFunc` only work when `column.sort` is enable. `sortFunc` allow you to define your sorting algorithm. This callback function accept six arguments: ```js { // omit... sort: true, - sortFunc: (a, b, order, dataField) => { - if (order === 'asc') return a - b; - else return b - a; + sortFunc: (valueA, valueB, order, dataField, rowA, rowB) => { + if (order === 'asc') return valueA - valueB; + else return valueB - valueA; } } ```