diff options
Diffstat (limited to 'src/components/ListTable.tsx')
-rw-r--r-- | src/components/ListTable.tsx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/components/ListTable.tsx b/src/components/ListTable.tsx index 5c1333a..c333698 100644 --- a/src/components/ListTable.tsx +++ b/src/components/ListTable.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import _ from 'lodash'; interface Field { key: string; @@ -28,7 +29,7 @@ const ListTable: React.FC<Props> = ({ items = [], fields, handleRowClick = () => className={`border-b hover:bg-gray-100 cursor-pointer ${index % 2 && 'bg-gray-50'}`} onClick={() => handleRowClick(index)} > - {fields.map(field => <td key={`${item._id} ${field.label}`} className="p-3">{item[field.key]}</td>)} + {fields.map(field => <td key={`${item._id} ${field.label}`} className="p-3">{_.get(item, field.key)}</td>)} </tr> ))} </tbody> |