From a8d5d35604a4386341b05290ec5a035a17c2d8b7 Mon Sep 17 00:00:00 2001 From: Jay Deshmukh <35005482+jay-deshmukh@users.noreply.github.com> Date: Wed, 15 Apr 2020 11:44:55 +0530 Subject: [PATCH] fix table (#117) - will return empty `td` for conditionally rendering cells. --- src/components/Table/config.js | 12 +----------- src/components/Table/js/cell.js | 4 ++++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/components/Table/config.js b/src/components/Table/config.js index 0da01c26..dffd724a 100644 --- a/src/components/Table/config.js +++ b/src/components/Table/config.js @@ -57,17 +57,7 @@ export const config = { date: { value: '01/01/2019', }, - delete_btn: { - props: { - theme: 'danger', - size: 'sm', - onClick: () => console.log('Delete Btn Click'), - }, - children: 'Delete', - events: { - onClick: () => console.log('Clicked the cell'), - }, - }, + delete_btn: null, input_test: { props: { type: 'number', diff --git a/src/components/Table/js/cell.js b/src/components/Table/js/cell.js index a1e6782a..3bb9007d 100644 --- a/src/components/Table/js/cell.js +++ b/src/components/Table/js/cell.js @@ -2,6 +2,10 @@ import React from 'react'; import PropTypes from 'prop-types'; export const Cell = ({ col, row }) => { + if (!row.values[col.id]) { + return ; + } + if (col.type === 'string') { return ( // eslint-disable-next-line jsx-a11y/click-events-have-key-events