Skip to content

Commit

Permalink
retain filterColumnsPartial value when recreating filter controls
Browse files Browse the repository at this point in the history
  • Loading branch information
whizzrd committed Nov 21, 2021
1 parent b42124f commit a4d2918
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/extensions/filter-control/utils.js
Expand Up @@ -329,14 +329,19 @@ export function createControls (that, header) {
addedFilterControl = true

if (column.searchable && that.options.filterTemplate[nameControl]) {
let value = column.filterDefault

if (that.filterColumnsPartial && that.filterColumnsPartial[column.field]) {
value = that.filterColumnsPartial[column.field]
}
html.push(
that.options.filterTemplate[nameControl](
that,
column.field,
column.filterControlPlaceholder ?
column.filterControlPlaceholder :
'',
column.filterDefault
value
)
)
}
Expand Down Expand Up @@ -377,7 +382,13 @@ export function createControls (that, header) {
selectControl = header.find(`.bootstrap-table-filter-control-${escapeID(column.field)}`)

addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault)
filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault)

let selected = column.filterDefault

if (that.filterColumnsPartial && that.filterColumnsPartial[column.field]) {
selected = that.filterColumnsPartial[column.field]
}
filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, selected)
} else {
throw new SyntaxError(
'Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' +
Expand Down

0 comments on commit a4d2918

Please sign in to comment.