隐藏已选择的项目jquery自动完成 [英] Hide already selected items jquery autocomplete

查看:96
本文介绍了隐藏已选择的项目jquery自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下:





.autocomplete({

minLength:0,

source:function(request,response){

response($。ui.autocomplete.filter(

data,extractLast(request.term)) );

},



在上面的代码中,获取所有自动填充数据'数据',并从数据中提取项目。

如何隐藏已经选择的项目。



请帮助我。



我尝试了什么:



隐藏已选择的项目jQuery自动完成

My code is given below


.autocomplete({
minLength: 0,
source: function (request, response) {
response($.ui.autocomplete.filter(
data, extractLast(request.term)));
},

In the above code,get all the autofill data 'data',and extract the item from the data.
How to hide the already selected item.

Please help me.

What I have tried:

Hide already selected items jQuery Autocomplete

推荐答案

.ui.autocomplete.filter(

data,extractLast(request.term)));

},



在上面的c ode,获取所有自动填充数据'数据',并从数据中提取项目。

如何隐藏已选择的项目。



请帮帮我。



我尝试过:



隐藏已选择的项目jQuery Autocomplete
.ui.autocomplete.filter(
data, extractLast(request.term)));
},

In the above code,get all the autofill data 'data',and extract the item from the data.
How to hide the already selected item.

Please help me.

What I have tried:

Hide already selected items jQuery Autocomplete


实际上,您可以在将代码发送到客户端之前使代码在服务器端过滤



以下是一个示例:

在查看页面上,通过传入其他参数来覆盖源

Actually, you can make the code to filter the list on server side before sending it to the client

Here is an example:
On the View page, overwrite the source by passing in additional parameter
function split(val) {
                  return val.split(/,\s*/);
              }
 function extractLast(term) {
                return split(term).pop();
            }

.autocomplete({
...
   source: function (request, response) {


.getJSON(
' YourController / Action'
{
term:extractLast(request.term),
sValue:
.getJSON( 'YourController/Action', { term: extractLast(request.term), sValue:


这篇关于隐藏已选择的项目jquery自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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