File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,9 @@ var calculations = [
109109 title: ' Amount' , value: ' amountTotal' ,
110110 template : function (val , row ) {
111111 return ' $' + val .toFixed (2 )
112+ },
113+ sortBy : function (row ) {
114+ return isNaN (row .amountTotal ) ? 0 : row .amountTotal
112115 }
113116 }
114117]
Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ var calculations = [
3030 {
3131 title : 'Count' ,
3232 value : 'count' ,
33- className : 'alignRight'
33+ className : 'alignRight' ,
34+ sortBy : function ( row ) { return row . count }
3435 } ,
3536 {
3637 title : 'Amount' ,
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ module.exports = createReactClass({
9797
9898 columns . push ( {
9999 type : 'dimension' , title : d . title , value : d . value ,
100- className : d . className , template : d . template
100+ className : d . className , template : d . template , sortBy : d . sortBy
101101 } )
102102 } )
103103
@@ -106,7 +106,7 @@ module.exports = createReactClass({
106106
107107 columns . push ( {
108108 type :'calculation' , title : c . title , template : c . template ,
109- value : c . value , className : c . className
109+ value : c . value , className : c . className , sortBy : c . sortBy
110110 } )
111111 } )
112112
@@ -177,7 +177,7 @@ module.exports = createReactClass({
177177 var sortCol = _ . find ( columns , function ( col ) {
178178 return col . title === sortByTitle
179179 } ) || { }
180- var sortBy = sortCol . type === 'dimension' ? sortCol . title : sortCol . value
180+ var sortBy = sortCol . sortBy || ( sortCol . type === 'dimension' ? sortCol . title : sortCol . value ) ;
181181 var sortDir = this . state . sortDir
182182
183183 var calcOpts = {
You can’t perform that action at this time.
0 commit comments