On expand-row jumping to filter-control input
Bootstraptable version(s) affected
1.20.2
Description
First a search with filter-control must be done. Then click on a + for expand-row. The page then always jumps up and has the input field in focus.
Example(s)
Simple example https://live.bootstrap-table.com/code/yeezy69/12392 for this demo:
https://user-images.githubusercontent.com/22444686/183893736-45f52a4c-e901-4b0b-966d-5fe32554f059.mp4
Possible Solutions
No response
Additional Context
No response
This issue is caused by this line: https://github.com/wenzhixin/bootstrap-table/blob/develop/src/extensions/filter-control/utils.js#L207 @djhvscf could you check it ? I'm not sure what should happen there and what not.
Well, that's the expected behavior regarding focus. But I think we could add a validation in order to focus an element only when we're not expanding a row. Let me check how we can implement this.
I have the same issue when using filter-control + search input.
Simple example : https://live.bootstrap-table.com/code/MakingOff/13930
Just like yeezy69 did, first filter one column (Item Name or Item Price, doesn't matter which) and then try using the search input. Every time the table gets filtered, the focus goes to the last filter-control input used, which makes the search bar completely unusable.
If anyone knows a quick fix for this, please let me know 🙏
EDIT: Quick fix :
$("#customSearch").on("focusin", () => { $("#table").bootstrapTable("triggerSearch"); });
(https://live.bootstrap-table.com/code/MakingOff/13931)
When the search input is focused, just trigger a search, so the filter-control columns cache gets refreshed and the input is no longer considered "focused"