自动填充文本框返回多个数据 [英] Autocomplete Textbox return multiple data

查看:82
本文介绍了自动填充文本框返回多个数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai,



我正在试用autocompelte文本框,就像MYNTRA Search一样,这意味着leftside项目和Rightside价格,请帮助我

我的代码是





< script type =text / javascript>

功能addRow(){



grid = $(#gvContra1 tr)。eq(1).clone(true);

$ (grid).removeClass(hide);

$(#gvContra1)。append(grid);

index = $(#gvContra1 tr) .length-1;



$(#gvContra1 tr)。eq(index).find(。accountHead)。autocomplete({



来源:功能(请求,响应){

$ .ajax({

url:'<%= ResolveUrl (〜/ Service.asmx / GetPartyDetails)%>',

数据:{'前缀':'+ request.term +'},

dataType:json,

类型:POST,

contentType:application / json; charset = utf-8,

成功:功能(数据){



响应($ .map(data.d,function(项目){

返回{



标签:item.split(' - ')[0],

val:item.split(' - ')[1]



}

}))



},

错误:函数(响应){

alert(response.responseText);

},

失败:功能(响应){

alert(response.responseText);

}

});

},





select:function(e,i){























},

minLength:1



});



}



< /脚本>





此代码仅返回左侧值

解决方案

( #gvContra1 tr)。eq(1).clone(true);


(grid).removeClass(hide);

(#gvContra1)。append(grid);

index =


Hai,

hai am trying in autocompelte textbox,just like MYNTRA Search,that means leftside item and Rightside price,pls help me
my code is


<script type="text/javascript">
function addRow() {

grid = $("#gvContra1 tr").eq(1).clone(true);
$(grid).removeClass("hide");
$("#gvContra1").append(grid);
index = $("#gvContra1 tr").length-1;

$("#gvContra1 tr").eq(index).find(".accountHead").autocomplete({

source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/Service.asmx/GetPartyDetails") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {

response($.map(data.d, function (item) {
return {

label: item.split('-')[0],
val: item.split('-')[1]

}
}))

},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},


select: function (e, i) {











},
minLength: 1

});

}

</script>


this code will return only left side value

解决方案

("#gvContra1 tr").eq(1).clone(true);


(grid).removeClass("hide");


("#gvContra1").append(grid);
index =


这篇关于自动填充文本框返回多个数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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