Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column filter seperated by space with similar name #6985

Open
pietos opened this issue Sep 25, 2023 · 7 comments
Open

Column filter seperated by space with similar name #6985

pietos opened this issue Sep 25, 2023 · 7 comments
Labels
Bug Issues which are marked as Bug

Comments

@pietos
Copy link

pietos commented Sep 25, 2023

Bootstraptable version(s) affected

1.22.1

Description

I have auto generated columns where the data-field contains a space. When you search on a record it will result in a situation where after the search the focus will be on a different column.

It has something to do with the fact that the name of the column is placed as a css class and it's similar to the neighbour column because of the space in the field-name.

image

image

Example(s)

No response

Possible Solutions

No response

Additional Context

No response

@pietos pietos added the Bug Issues which are marked as Bug label Sep 25, 2023
@pietos
Copy link
Author

pietos commented Sep 25, 2023

I managed to find out that it happens because this function splits everything on a space and then searched for the class that starts with bootstrap-table-filter-control-

bootstrap-table-filter-control.js line 4304
image

@pietos
Copy link
Author

pietos commented Sep 25, 2023

I managed to fix this, can somebody verify for me if this is it okay and commit it ?

bootstrap-table-filter-control.js line 4828 - 4835 you have to wrap the column.field in the escapeID
image

Extend the escapeID with 1 more line of code:
id = String(id).replace(/ /g, "_");
image

As a result it now takes the unique and correct classes
image

and the column doesn't break anymore
image

@UtechtDustin
Copy link
Collaborator

The file bootstrap-table-filter-control.js don't have 4000+ lines, it only have 566 lines.

Also i'dont think we support fields with spaces and i also think we should not support it.
It's such a edge case, no body (should) use it.
What do you think @wenzhixin @djhvscf ?

@pietos
Copy link
Author

pietos commented Oct 2, 2023

@DustinUtecht @wenzhixin Sure you have a point there, but not escaping those column fields for the css classes is also a bit strange in my opinion. We connect the table to a mongoDB database, and the data keys in there can contain spaces which should not be a problem. If we just escape the values before assigning them as a CSS class the whole problem is solved.

Also regarding the line numbers, you looked in the src folder, the file I mentioned is from the dist folder.

https://github.com/wenzhixin/bootstrap-table/blob/develop/dist/extensions/filter-control/bootstrap-table-filter-control.js

@UtechtDustin
Copy link
Collaborator

We never check/develop in the dist folder.
Please note down the lines in the src code if possible.
Let us wait for the opinion of @wenzhixin and @djhvscf.

@pietos
Copy link
Author

pietos commented Apr 16, 2024

@wenzhixin any update regarding this issue?

@wenzhixin
Copy link
Owner

There is no update yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are marked as Bug
Projects
None yet
Development

No branches or pull requests

3 participants