Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
712 views
in Technique[技术] by (71.8m points)

angular - Search function customization

which shows a table with its column. What I need is building a search lookup function instead of the default filter function, so that ON The List of Values in Mini Filter window and NOT the whole table: [![enter image description here][1]][1]

If typing the full name Michael then the table will be filtered by Michael, OR if I type the phone number then the name of Michael will be filtered by Michael. in other words.

I dont what to change the values of the filter to filter based tokens, and i also dont want to change the columns values to column based token, but i only need that if the input of the user in the search field is inside the tokens then returns the key of the token and show it to the user.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Got a working example here. Note that I'm not very familiar with Angular, so the code might seem weird.

I defined a custom filter, called CustomSetFilter, in which the text input functions as a search field for the tokens of each checkbox as defined in filterData. If the input is empty, all checkboxes appear. If not, only checkboxes that have a token equal to the input's value (ignoring case) will show up. This can be seen in the onChange() function.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...