bootstrap-table icon indicating copy to clipboard operation
bootstrap-table copied to clipboard

On expand-row jumping to filter-control input

Open yeezy69 opened this issue 3 years ago • 3 comments

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

yeezy69 avatar Aug 10 '22 11:08 yeezy69

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.

UtechtDustin avatar Aug 11 '22 18:08 UtechtDustin

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.

djhvscf avatar Aug 29 '22 20:08 djhvscf

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"

MakingOff avatar Jan 12 '23 11:01 MakingOff