From 051e1d17af81a1f8bdddd05842007b610aa8a05a Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 24 Aug 2020 23:05:04 -0400 Subject: [PATCH] Filter out undefined rows --- packages/react-bootstrap-table2/src/body.js | 44 +++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/packages/react-bootstrap-table2/src/body.js b/packages/react-bootstrap-table2/src/body.js index f176bbf80..e5d1626e1 100644 --- a/packages/react-bootstrap-table2/src/body.js +++ b/packages/react-bootstrap-table2/src/body.js @@ -87,27 +87,29 @@ class Body extends React.Component { additionalRowProps.selectRow = selectRow; } - content = data.map((row, index) => { - const key = _.get(row, keyField); - const baseRowProps = { - key, - row, - tabIndexCell, - columns, - keyField, - cellEdit, - value: key, - rowIndex: index, - visibleColumnSize, - attrs: rowEvents || {}, - ...additionalRowProps - }; - - baseRowProps.style = _.isFunction(rowStyle) ? rowStyle(row, index) : rowStyle; - baseRowProps.className = (_.isFunction(rowClasses) ? rowClasses(row, index) : rowClasses); - - return ; - }); + content = data + .filter(row => row) + .map((row, index) => { + const key = _.get(row, keyField); + const baseRowProps = { + key, + row, + tabIndexCell, + columns, + keyField, + cellEdit, + value: key, + rowIndex: index, + visibleColumnSize, + attrs: rowEvents || {}, + ...additionalRowProps + }; + + baseRowProps.style = _.isFunction(rowStyle) ? rowStyle(row, index) : rowStyle; + baseRowProps.className = (_.isFunction(rowClasses) ? rowClasses(row, index) : rowClasses); + + return ; + }); } return (