Filter control clear after selected in table has data-height config

Author: vuvtdhhCreated Sep 18, 2023Updated May 13, 2026
Labelsfilter-controlBug

Bootstraptable version(s) affected

1.22.1

Description

Filter control clear after selected in table has data-height config. Before filter: image

After filter selected $1 on Item Price column: image

Example(s)

https://live.bootstrap-table.com/code/vuvtdhh/16207

Possible Solutions

I see line 8248. image When this.options.height has value. The expression is true and this.resetHeader(); will be called, table header will re-init with initFilterSelectControls function and this function didn't give selected item a selected attribute. I'm not sure what the idea is. Please review this issue.

Update solution I can't find any line in initFilterSelectControls function that set checked attribute for the select option. So, I modified line 4488, I get selected value in filterColumnsPartial property and pass it to addOptionToSelectControl function. After change this line, the table select filter will working fine. File name: bootstrap-table-filter-control.js Line: 4488 image After change line 4488, the commented line is the origin. image

Additional Context

  • Microsoft Edge
  • Google Chrome

Source: wenzhixin/bootstrap-table