File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 292
292
undefinedText : '-' ,
293
293
sortName : undefined ,
294
294
sortOrder : 'asc' ,
295
+ sortStable : false ,
295
296
striped : false ,
296
297
columns : [ [ ] ] ,
297
298
data : [ ] ,
934
935
}
935
936
936
937
if ( index !== - 1 ) {
938
+ if ( this . options . sortStable ) {
939
+ $ . each ( this . data , function ( i , row ) {
940
+ if ( ! row . hasOwnProperty ( '_position' ) ) row . _position = i ;
941
+ } ) ;
942
+ }
943
+
937
944
this . data . sort ( function ( a , b ) {
8000
code>
938
945
if ( that . header . sortNames [ index ] ) {
939
946
name = that . header . sortNames [ index ] ;
954
961
bb = '' ;
955
962
}
956
963
964
+ if ( that . options . sortStable && aa === bb ) {
965
+ aa = a . _position ;
966
+ bb = b . _position ;
967
+ }
968
+
957
969
// IF both values are numeric, do a numeric comparison
958
970
if ( $ . isNumeric ( aa ) && $ . isNumeric ( bb ) ) {
959
971
// Convert numerical values form string to float.
You can’t perform that action at this time.
0 commit comments