From 8e6b9d5fab78f6752060907953475ede002018b8 Mon Sep 17 00:00:00 2001 From: zhixin Date: Tue, 16 Jul 2019 08:17:22 +0800 Subject: [PATCH] Fixed search bug in hidden columns --- src/bootstrap-table.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bootstrap-table.js b/src/bootstrap-table.js index f4ff064bdf..f671d3a124 100644 --- a/src/bootstrap-table.js +++ b/src/bootstrap-table.js @@ -237,10 +237,6 @@ class BootstrapTable { } columns.forEach((column, j) => { - if (!column.visible) { - return - } - const class_ = Utils.sprintf(' class="%s"', column['class']) const unitWidth = column.widthUnit const width = parseFloat(column.width) @@ -252,6 +248,10 @@ class BootstrapTable { ? (!column.showSelectTitle ? '36px' : undefined) : (width ? width + unitWidth : undefined)) + if (typeof column.fieldIndex === 'undefined' && !column.visible) { + return + } + if (typeof column.fieldIndex !== 'undefined') { this.header.fields[column.fieldIndex] = column.field this.header.styles[column.fieldIndex] = align + style @@ -264,6 +264,10 @@ class BootstrapTable { this.header.cellStyles[column.fieldIndex] = column.cellStyle this.header.searchables[column.fieldIndex] = column.searchable + if (!column.visible) { + return + } + if (this.options.cardView && (!column.cardVisible)) { return }