aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/TableBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/TableBox.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/TableBox.tsx17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/TableBox.tsx b/src/client/views/nodes/DataVizBox/components/TableBox.tsx
index f244502a4..7d6f934b9 100644
--- a/src/client/views/nodes/DataVizBox/components/TableBox.tsx
+++ b/src/client/views/nodes/DataVizBox/components/TableBox.tsx
@@ -34,7 +34,8 @@ export class TableBox extends React.Component<TableBoxProps> {
@computed get _tableData() {
if (this.incomingLinks.length! <= 0) return this.props.pairs;
- return this.props.pairs?.filter(pair => this.incomingLinks[0]!.selected && StrListCast(this.incomingLinks[0].selected).includes(pair.guid))
+ var guids = StrListCast(this.props.layoutDoc.rowGuids);
+ return this.props.pairs?.filter(pair => this.incomingLinks[0]!.selected && StrListCast(this.incomingLinks[0].selected).includes(guids[this.props.pairs.indexOf(pair)]))
}
@computed get incomingLinks() {
@@ -45,7 +46,10 @@ export class TableBox extends React.Component<TableBoxProps> {
}
@computed get columns() {
- return this._tableData.length ? Array.from(Object.keys(this._tableData[0])).filter(header => header!='guid' && header!='') : [];
+ if (!this.props.layoutDoc.rowGuids) this.props.layoutDoc.rowGuids = new List<string>();
+ const guids = Cast(this.props.layoutDoc.rowGuids, listSpec("string"), null);
+ if (guids.length==0) this.props.pairs.map(row => guids.push(Utils.GenerateGuid()));
+ return this._tableData.length ? Array.from(Object.keys(this._tableData[0])).filter(header => header!='') : [];
}
render() {
@@ -121,18 +125,19 @@ export class TableBox extends React.Component<TableBoxProps> {
<tbody>
{this._tableData?.map((p, i) => {
var containsData = false;
+ var guid = StrListCast(this.props.layoutDoc.rowGuids)![this.props.pairs.indexOf(p)]
this.columns.map(col => {if (p[col]!='' && p[col]!=null && p[col]!=undefined) containsData = true})
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(p.guid)) selected.splice(selected.indexOf(p.guid), 1);
+ if (selected.includes(guid)) selected.splice(selected.indexOf(guid), 1);
else {
- selected.push(p.guid)};
+ selected.push(guid)};
})} style={
- { fontWeight: StrListCast(this.props.layoutDoc.selected).includes(p.guid) ? 'bold' : '' , width: '110%',
- background: StrListCast(this.props.layoutDoc.selected).includes(p.guid) ? 'lightgrey' : '' }}>
+ { fontWeight: StrListCast(this.props.layoutDoc.selected).includes(guid) ? 'bold' : '' , width: '110%',
+ background: StrListCast(this.props.layoutDoc.selected).includes(guid) ? 'lightgrey' : '' }}>
{this.columns.map(col => (
(this.props.layoutDoc.selected)?
<td key={this.columns.indexOf(col)} style={{border: '1px solid black'}}>