mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Use nested params as table column values
This commit is contained in:
parent
e355391a4e
commit
7a7325adf5
1 changed files with 6 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { resolve } from '@/_helpers/utils';
|
||||
import { resolve, findProp } from '@/_helpers/utils';
|
||||
|
||||
export const Table = function Table({ id, component, onComponentClick, currentState, onEvent }) {
|
||||
|
||||
|
|
@ -15,6 +15,10 @@ export const Table = function Table({ id, component, onComponentClick, currentSt
|
|||
data = resolve(component.definition.properties.data.value, currentState, []);
|
||||
console.log('resolved param', data);
|
||||
}
|
||||
|
||||
function findColumnValue(row, name) {
|
||||
return findProp(row, name);
|
||||
}
|
||||
|
||||
// Quick fix, need to remove later
|
||||
data = data ? data : [];
|
||||
|
|
@ -40,7 +44,7 @@ export const Table = function Table({ id, component, onComponentClick, currentSt
|
|||
|
||||
{data.map((row =>
|
||||
<tr onClick={(e) => { e.stopPropagation(); onEvent('onRowClicked', { component, row }); }}>
|
||||
{columns.map((column) => <td>{row[column.name]}</td>)}
|
||||
{columns.map((column) => <td>{findColumnValue(row, column.name)}</td>)}
|
||||
|
||||
{actions.value.length > 0 &&
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Reference in a new issue