Skip to content

Commit

Permalink
Fix datatable canvas element to use column id instead of name
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmic committed Aug 30, 2021
1 parent b354b97 commit e2d291d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const getIcon = (type: DatatableColumnType | null) => {

const getColumnName = (col: DatatableColumn) => (typeof col === 'string' ? col : col.name);

const getColumnId = (col: DatatableColumn) => (typeof col === 'string' ? col : col.id);

const getColumnType = (col: DatatableColumn) => col.meta?.type || null;

const getFormattedValue = (val: any, type: any) => {
Expand Down Expand Up @@ -85,7 +87,7 @@ export const Datatable: FC<Props> = ({
<tr key={i} className="canvasDataTable__tr">
{datatable.columns.map((col) => (
<td key={`row-${i}-${getColumnName(col)}`} className="canvasDataTable__td">
{getFormattedValue(row[getColumnName(col)], getColumnType(col))}
{getFormattedValue(row[getColumnId(col)], getColumnType(col))}
</td>
))}
</tr>
Expand Down

0 comments on commit e2d291d

Please sign in to comment.