Commit ecc621fc authored by YiChia Huang's avatar YiChia Huang Committed by chicm-ms
Browse files

added search trail by id function (#455)

parent c265903e
...@@ -201,14 +201,13 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -201,14 +201,13 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
} }
// search a specific trial by trial No. // search a specific trial by trial No.
searchTrialNo = (value: string) => { searchTrial = (value: string) => {
window.clearInterval(this.interTableList); window.clearInterval(this.interTableList);
const { tableBaseSource } = this.state; const { tableBaseSource } = this.state;
const searchResultList: Array<TableObj> = []; const searchResultList: Array<TableObj> = [];
Object.keys(tableBaseSource).map(key => { Object.keys(tableBaseSource).map(key => {
const item = tableBaseSource[key]; const item = tableBaseSource[key];
if (item.sequenceId.toString() === value) { if (item.sequenceId.toString() === value || item.id.includes(value)) {
searchResultList.push(item); searchResultList.push(item);
} }
}); });
...@@ -285,8 +284,8 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> { ...@@ -285,8 +284,8 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
</Col> </Col>
<Col span={12} className="btns"> <Col span={12} className="btns">
<Search <Search
placeholder="input search Trial No." placeholder="search by Trial No. and id"
onSearch={value => this.searchTrialNo(value)} onSearch={value => this.searchTrial(value)}
style={{ width: 200 }} style={{ width: 200 }}
id="searchTrial" id="searchTrial"
/> />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment