diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-08-07 10:53:09 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-08-07 10:53:09 -0400 |
commit | 1bfa61ae441458cdcd860eb39e617417d013f1fa (patch) | |
tree | 0a3cc466457a04a14c0a52841d906348defeadbd /src/client/views/nodes/DataVizBox/components/TableBox.tsx | |
parent | 8cbfb72751a3f8814c0dbda54c8ed22c8bb58783 (diff) |
Issues when you remove a highlighted row more than 1 chart up the tree fixed
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/TableBox.tsx')
-rw-r--r-- | src/client/views/nodes/DataVizBox/components/TableBox.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/TableBox.tsx b/src/client/views/nodes/DataVizBox/components/TableBox.tsx index 8a99d332f..a7cc3f2fb 100644 --- a/src/client/views/nodes/DataVizBox/components/TableBox.tsx +++ b/src/client/views/nodes/DataVizBox/components/TableBox.tsx @@ -52,7 +52,18 @@ export class TableBox extends React.Component<TableBoxProps> { return this._tableData.length ? Array.from(Object.keys(this._tableData[0])).filter(header => header!='') : []; } + filterSelectedRowsDown() { + if (!this.props.layoutDoc.selected) this.props.layoutDoc.selected = new List<string>(); + const selected = Cast(this.props.layoutDoc.selected, listSpec("string"), null); + const incomingSelected = this.incomingLinks.length? StrListCast(this.incomingLinks[0].selected) : undefined; + if (incomingSelected){ + selected.map(guid => { + if (!incomingSelected.includes(guid)) selected.splice(selected.indexOf(guid), 1)}); // filters through selected to remove guids that were removed in the incoming data + } + } + render() { + this.filterSelectedRowsDown(); if (this._tableData.length>0){ return ( <div className="table-container" style={{height: this.props.height+this.props.margin.top+this.props.margin.bottom}}> @@ -133,7 +144,6 @@ export class TableBox extends React.Component<TableBoxProps> { if (containsData){ return ( <tr key={i} className="table-row" onClick={action(e => { - if (!this.props.layoutDoc.selected) this.props.layoutDoc.selected = new List<string>(); const selected = Cast(this.props.layoutDoc.selected, listSpec("string"), null); if (selected.includes(guid)) selected.splice(selected.indexOf(guid), 1); else { |