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

igxTextHighlight - searching has side effect on unmatched cell. #1493

Closed
tkiryu opened this issue Jun 7, 2018 · 4 comments
Closed

igxTextHighlight - searching has side effect on unmatched cell. #1493

tkiryu opened this issue Jun 7, 2018 · 4 comments

Comments

@tkiryu
Copy link

tkiryu commented Jun 7, 2018

Steps to reproduce

  1. Go to https://stackblitz.com/edit/igx-highlight-text-issue
  2. Type "aaa" in the search box.
  3. Press enter key.

Result

There are two problems.

  1. igxCell template style is cleared.
  2. undefined is displayed on dummy cell.

Expected result

1, 2. Nothing should happen to the cell that the search word doesn't match.

@DDavidkov
Copy link
Contributor

@tkiryu Both of these things aren't bugs with the search.

The search simply replaces the cell content with text and span elements. So it isn't a good idea to define styles inline, as the node itself will be replaced with new content. Instead you can simply use the cellClasses input of the column to define a custom class for the cells and use this class for your styling. I modified the stackblitz to demonstrate this.

As for the dummy column, any column for which the search feature makes no sense can be excluded using its searchable input. Simply set it to false and the undefined text will no longer appear. Note that this input is not present in 6.0.0 and will be included in the next release.

@tkiryu
Copy link
Author

tkiryu commented Jun 12, 2018

@DDavidkov , thank you for your comment. I get your point.

As for the latter, for sure, searchable input will solve the issue. Thank you for your info. I'm looking forward to it.

But, as for the former, I have different thoughts. Let me explain later on.

@tkiryu
Copy link
Author

tkiryu commented Jun 12, 2018

@DDavidkov

There is a common scenario that changing cell style according to its value or row data or something(Please refer to #1079).

In order to achieve that, cellClasses is not suitable. Instead, we currently need to use igxCell template and set style to its child nodes. That's why I think defining styles inline is a possibility.

At least, only the cells that matches search text should be replaced with new content. Unmatched cells should have no side effect.

@DDavidkov
Copy link
Contributor

@tkiryu
I understand your concerns, but still we can't do a lot in this case.

Support for the search to not change the structure and attributes of arbitrary markup will be a very difficult task that will have limited use. Also, while not affecting unmatched cells will help a bit, it won't really solve anything, as the problem will still appear in the matched cells, so I am not willing to introduce changes in the code for no reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants