搜索功能定制 [英] Search function customization

查看:66
本文介绍了搜索功能定制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显示带有其列的表.我需要的是构建搜索查找功能而不是默认过滤器功能,以便在迷你过滤器"窗口中的值列表"中而不是整个表中:[![在此处输入图片描述] [1]] [1]

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]

如果键入全名Michael,则该表将由Michael过滤,或者,如果我键入电话号码,则Michael的名称将由Michael过滤.换句话说.

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.

推荐答案

有一个工作示例这里.请注意,我对Angular不太熟悉,因此代码可能看起来很奇怪.

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

我定义了一个自定义过滤器,称为 CustomSetFilter ,其中文本输入用作 filterData <中定义的每个复选框的 tokens 的搜索字段./code>.如果输入为空,则会显示所有复选框.如果不是,则只会显示令牌等于输入值(忽略大小写)的复选框.可以在 onChange()函数中看到.

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.

这篇关于搜索功能定制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆