From 8beeab367c079b7545f27ad391220cbe6111cea6 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Sat, 30 Dec 2023 01:48:31 +0000 Subject: [PATCH] Fixed #5005 - BodyRow: Cannot read propertie of null (reading 'forEach) --- components/lib/datatable/BodyRow.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/lib/datatable/BodyRow.vue b/components/lib/datatable/BodyRow.vue index c7c747862..7562a0e2e 100644 --- a/components/lib/datatable/BodyRow.vue +++ b/components/lib/datatable/BodyRow.vue @@ -559,14 +559,18 @@ export default { } }, columnsLength() { - let hiddenColLength = 0; + if (this.columns) { + let hiddenColLength = 0; - this.columns.forEach((column) => { - if (this.columnProp(column, 'selectionMode') === 'single') hiddenColLength--; - if (this.columnProp(column, 'hidden')) hiddenColLength++; - }); + this.columns.forEach((column) => { + if (this.columnProp(column, 'selectionMode') === 'single') hiddenColLength--; + if (this.columnProp(column, 'hidden')) hiddenColLength++; + }); - return this.columns ? this.columns.length - hiddenColLength : 0; + return this.columns.length - hiddenColLength; + } + + return 0; } }, components: {