It would be nice if we could add some kind of text/search box to the widget so that I can filter to only show terms that match a string typed in. This is helpful with larger taxonomy trees.

Comments

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new2.88 KB

Patch that might not be ready (I'm admittedly not good at JS), but it worked for me.

JacksonBison’s picture

Appears to work, however I can't seem to enable it on a custom form...

I assume it should be '#search' => 1, but it's not working...

JacksonBison’s picture

Issue summary: View changes

Code doesn't quite work, and isn't picking up all matches.

Change: var hasMatch = $(this).text().toLowerCase().indexOf(searchTerms) > 0;
to: var hasMatch = $(this).text().toLowerCase().indexOf(searchTerms) >= 0;

Seems to fix the problem

osopolar’s picture

Following the documentaion of indexOf() it makes sense to check for >= 0:

Return value

The index of the first occurrence of the specified value; -1 if not found.

The patch fixes that and also adds a missing ";" and the class term-reference-tree-filter-match to be able to highlight the matching labels.

pifagor’s picture

Status: Needs review » Reviewed & tested by the community

Look good

alex_optim’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +dckyiv2019

This patch is very old. Needs work.

sano’s picture

Status: Needs work » Needs review
StatusFileSize
new3.38 KB

Thaks for this. Attaching a re-rolled patch against the 7.x-1.x branch.

anybody’s picture

vladimiraus’s picture

Status: Needs review » Closed (outdated)

Thank you everyone for your contribution.
Drupal 7 is no longer supported but we always need support for Drupal 11 version.
Closing as outdated.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.