@@ -373,21 +373,35 @@ export default class FusionTable<
373
373
this . mergeOncoKbIcons = ! ! props . mergeOncoKbIcons ;
374
374
}
375
375
376
- private defaultFilter (
377
- data : StructuralVariant [ ] ,
378
- dataField : string ,
376
+ private filterColumnFn (
377
+ label : FusionTableColumnProps ,
378
+ d : StructuralVariant [ ] ,
379
379
filterStringUpper : string
380
380
) : boolean {
381
- const matchingData = data . find ( next => {
382
- const val = ( next as any ) [ dataField ] ;
381
+ if ( label . columnType === FusionTableColumnType . CANCER_TYPE_DETAILED ) {
382
+ let data : string | null = null ;
383
+ if ( this . props . uniqueSampleKeyToTumorType ) {
384
+ data =
385
+ this . props . uniqueSampleKeyToTumorType [
386
+ d [ 0 ] . uniqueSampleKey
387
+ ] || null ;
388
+ }
383
389
return (
384
- val &&
385
- String ( val )
386
- . toUpperCase ( )
387
- . includes ( filterStringUpper )
390
+ data !== null &&
391
+ data . toUpperCase ( ) . indexOf ( filterStringUpper ) > - 1
388
392
) ;
389
- } ) ;
390
- return Boolean ( matchingData ) ;
393
+ } else {
394
+ const matchingData = d . find ( next => {
395
+ const val = ( next as any ) [ label . attribute ] ;
396
+ return (
397
+ val &&
398
+ String ( val )
399
+ . toUpperCase ( )
400
+ . includes ( filterStringUpper )
401
+ ) ;
402
+ } ) ;
403
+ return Boolean ( matchingData ) ;
404
+ }
391
405
}
392
406
393
407
private renderColumnFn (
@@ -616,7 +630,7 @@ export default class FusionTable<
616
630
d : StructuralVariantExt [ ] ,
617
631
filterString : string ,
618
632
filterStringUpper : string
619
- ) => this . defaultFilter ( d , label . attribute , filterStringUpper ) ,
633
+ ) => this . filterColumnFn ( label , d , filterStringUpper ) ,
620
634
visible : visibleColumns . indexOf ( label . columnType ) > - 1 ,
621
635
} ;
622
636
} ) ;
@@ -706,7 +720,7 @@ export default class FusionTable<
706
720
columns = { this . columns }
707
721
dataStore = { this . props . dataStore }
708
722
downloadDataFetcher = { this . props . downloadDataFetcher }
709
- initialItemsPerPage = { 50 }
723
+ initialItemsPerPage = { this . props . initialItemsPerPage }
710
724
initialSortColumn = { this . props . initialSortColumn }
711
725
initialSortDirection = { this . props . initialSortDirection }
712
726
itemsLabel = { this . props . itemsLabel }
0 commit comments