@@ -33,8 +33,8 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
3333 sequenceImportPanel : this ,
3434 extend : 'Ext.data.Model' ,
3535 fields : [
36- { name : 'fileGroupId' , allowBlank : false } ,
37- { name : 'readset' , allowBlank : false } ,
36+ { name : 'fileGroupId' , allowBlank : false , sortType : SequenceAnalysis . Utils . getNaturalSortValue } ,
37+ { name : 'readset' , allowBlank : false , sortType : SequenceAnalysis . Utils . getNaturalSortValue } ,
3838 { name : 'readsetname' , useNull : true } ,
3939 { name : 'importType' , useNull : true } ,
4040 { name : 'barcode5' , useNull : true } ,
@@ -128,8 +128,8 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
128128 model : Ext4 . define ( 'SequenceAnalysis.model.ReadsetDataModel' , {
129129 extend : 'Ext.data.Model' ,
130130 fields : [
131- { name : 'id' } ,
132- { name : 'fileGroupId' , allowBlank : false } ,
131+ { name : 'id' , sortType : SequenceAnalysis . Utils . getNaturalSortValue } ,
132+ { name : 'fileGroupId' , allowBlank : false , sortType : SequenceAnalysis . Utils . getNaturalSortValue } ,
133133 { name : 'fileRecord1' } ,
134134 { name : 'fileRecord2' } ,
135135 { name : 'platformUnit' } ,
@@ -332,7 +332,7 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
332332 distinctGroups . push ( r . get ( 'fileGroupId' ) ) ;
333333 }
334334 } , this ) ;
335- distinctGroups = Ext4 . unique ( distinctGroups ) ;
335+ distinctGroups = Ext4 . unique ( distinctGroups ) . sort ( SequenceAnalysis . Utils . naturalSortFn ) ;
336336
337337 var found = [ ] ;
338338 Ext4 . Array . forEach ( this . fileGroupStore . getRange ( ) , function ( fg ) {
@@ -424,7 +424,13 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
424424 TENX_REGEX : / ^ ( .+ ?) ( _ [ 0 - 9 ] + ) { 0 , 1 } _ S ( .+ ) _ L ( .+ ) _ ( R ) { 0 , 1 } ( [ 0 - 9 ] ) ( _ [ 0 - 9 ] + ) { 0 , 1 } ( \. f ( a s t ) { 0 , 1 } q ) ( \. g z ) ? $ / i,
425425
426426 populateSamples : function ( orderType , isPaired ) {
427- this . fileNameStore . sort ( 'displayName' , 'ASC' ) ;
427+ this . fileNameStore . sort ( [ {
428+ sorterFn : function ( o1 , o2 ) {
429+ o1 = o1 . get ( 'displayName' ) ;
430+ o2 = o2 . get ( 'displayName' ) ;
431+ return o1 = SequenceAnalysis . Utils . naturalSortFn ( o1 , o2 ) ;
432+ }
433+ } ] ) ;
428434 this . readDataStore . removeAll ( ) ;
429435 var errorMsgs = [ ] ;
430436
@@ -483,9 +489,7 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
483489 }
484490 } , this ) ;
485491
486- var keys = Ext4 . Object . getKeys ( map ) ;
487- keys . sort ( ) ;
488-
492+ var keys = Ext4 . Object . getKeys ( map ) . sort ( SequenceAnalysis . Utils . naturalSortFn ) ;
489493 Ext4 . Array . forEach ( keys , function ( key ) {
490494 if ( Ext4 . isArray ( map [ key ] ) ) {
491495 Ext4 . Array . forEach ( map [ key ] , function ( r ) {
@@ -563,14 +567,15 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
563567 }
564568 }
565569
570+ this . readDataStore . sort ( 'fileGroupId' ) ;
566571 this . down ( '#readDataGrid' ) . getView ( ) . refresh ( ) ;
567572
568573 //populate readsets
569574 var distinctNames = [ ] ;
570575 this . readDataStore . each ( function ( r ) {
571576 distinctNames . push ( r . get ( 'fileGroupId' ) ) ;
572577 } , this ) ;
573- distinctNames = Ext4 . unique ( distinctNames ) ;
578+ distinctNames = Ext4 . unique ( distinctNames ) . sort ( SequenceAnalysis . Utils . naturalSortFn ) ;
574579
575580 //update fileGroupIds
576581 Ext4 . Array . forEach ( distinctNames , function ( name ) {
@@ -947,7 +952,7 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
947952 model : this . fileNameStore . model
948953 } ) ;
949954
950- this . fileNames . sort ( ) ;
955+ this . fileNames . sort ( SequenceAnalysis . Utils . naturalSortFn ) ;
951956 Ext4 . Msg . wait ( 'Loading...' ) ;
952957 var multi = new LABKEY . MultiRequest ( ) ;
953958 multi . add ( LABKEY . Ajax . request , {
@@ -1073,8 +1078,20 @@ Ext4.define('SequenceAnalysis.panel.SequenceImportPanel', {
10731078 }
10741079 } , this ) ;
10751080
1076- this . fileNameStore . sort ( 'displayName' ) ;
1077- this . fileNameStoreCopy . sort ( 'displayName' ) ;
1081+ this . fileNameStore . sort ( [ {
1082+ sorterFn : function ( o1 , o2 ) {
1083+ o1 = o1 . get ( 'displayName' ) ;
1084+ o2 = o2 . get ( 'displayName' ) ;
1085+ return SequenceAnalysis . Utils . naturalSortFn ( o1 , o2 ) ;
1086+ }
1087+ } ] ) ;
1088+ this . fileNameStoreCopy . sort ( [ {
1089+ sorterFn : function ( o1 , o2 ) {
1090+ o1 = o1 . get ( 'displayName' ) ;
1091+ o2 = o2 . get ( 'displayName' ) ;
1092+ return SequenceAnalysis . Utils . naturalSortFn ( o1 , o2 ) ;
1093+ }
1094+ } ] ) ;
10781095
10791096 this . down ( '#fileListView' ) . refresh ( ) ;
10801097 this . down ( '#totalFiles' ) . update ( 'Total files: ' + this . fileNameStore . getCount ( ) ) ;
0 commit comments