Skip to content

Commit f295b56

Browse files
committed
Fix filter on Cancer Type Detailed
1 parent 8a70caf commit f295b56

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

src/shared/components/fusionTable/FusionTable.tsx

+27-13
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,35 @@ export default class FusionTable<
373373
this.mergeOncoKbIcons = !!props.mergeOncoKbIcons;
374374
}
375375

376-
private defaultFilter(
377-
data: StructuralVariant[],
378-
dataField: string,
376+
private filterColumnFn(
377+
label: FusionTableColumnProps,
378+
d: StructuralVariant[],
379379
filterStringUpper: string
380380
): 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+
}
383389
return (
384-
val &&
385-
String(val)
386-
.toUpperCase()
387-
.includes(filterStringUpper)
390+
data !== null &&
391+
data.toUpperCase().indexOf(filterStringUpper) > -1
388392
);
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+
}
391405
}
392406

393407
private renderColumnFn(
@@ -616,7 +630,7 @@ export default class FusionTable<
616630
d: StructuralVariantExt[],
617631
filterString: string,
618632
filterStringUpper: string
619-
) => this.defaultFilter(d, label.attribute, filterStringUpper),
633+
) => this.filterColumnFn(label, d, filterStringUpper),
620634
visible: visibleColumns.indexOf(label.columnType) > -1,
621635
};
622636
});
@@ -706,7 +720,7 @@ export default class FusionTable<
706720
columns={this.columns}
707721
dataStore={this.props.dataStore}
708722
downloadDataFetcher={this.props.downloadDataFetcher}
709-
initialItemsPerPage={50}
723+
initialItemsPerPage={this.props.initialItemsPerPage}
710724
initialSortColumn={this.props.initialSortColumn}
711725
initialSortDirection={this.props.initialSortDirection}
712726
itemsLabel={this.props.itemsLabel}

0 commit comments

Comments
 (0)