From 7a41821d9ec0cd7969cd4941a382bc3767c8f6a9 Mon Sep 17 00:00:00 2001 From: zhixin Date: Wed, 13 Nov 2019 22:14:50 +0800 Subject: [PATCH] Fixed filter not work bug with undefined for filter-control extension --- CHANGELOG.md | 1 + .../filter-control/bootstrap-table-filter-control.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf255d1a5f..4a429092e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ ChangeLog - **Update:** Fixed `checkAll` event bug with sortable checkbox field. - **Update:** Fixed checkbox and not-found td style errors. - **Update:** Fixed `hideUnusedSelectOptions` not work bug for filter-control extension. +- **Update:** Fixed filter not work bug with `undefined` for filter-control extension. - **Update:** Fixed `virtualScroll` option bug with treegrid extension. - **Update:** Fixed input keyboard bug for mobile extension. - **Update:** Fixed detail view column reorder bug for reorder-columns extension. diff --git a/src/extensions/filter-control/bootstrap-table-filter-control.js b/src/extensions/filter-control/bootstrap-table-filter-control.js index 34bdaf7b70..de71f2e229 100644 --- a/src/extensions/filter-control/bootstrap-table-filter-control.js +++ b/src/extensions/filter-control/bootstrap-table-filter-control.js @@ -691,8 +691,11 @@ $.BootstrapTable = class extends $.BootstrapTable { that.data = fp ? that.options.data.filter((item, i) => { const itemIsExpected = [] - Object.keys(item).forEach((x, index) => { - const key = that.header.fields[index] + const keys1 = Object.keys(item) + const keys2 = Object.keys(fp) + const keys = keys1.concat(keys2.filter(item => !keys1.includes(item))) + + keys.forEach(key => { const thisColumn = that.columns[that.fieldsColumnsIndex[key]] const fval = (fp[key] || '').toLowerCase() let value = Utils.getItemField(item, key, false)