//条码录入,自动完成功能
function addAutoComplete() {
$('#txt_spuNo').autocomplete({
autoFocus: true,
source: function (request, response) {
$.ajax({
url: "../HandlerBase.ashx?action=TipBarcode",
data: { spu: request.term },
success: function (data) {
response($.parseJSON(data));
}
});
},
minLength: 3
    });
}

自定义格式:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<link href="../Content/themes/base/all.css" rel="stylesheet" />
<script src="../Scripts/jquery-1.6.4.min.js"></script>
<script src="../Scripts/jquery-ui-1.11.4.min.js"></script>
<script type="text/javascript">
$(function () {
addAutoComplete();
});
function addAutoComplete() {
$('#txt_Sku').autocomplete({
autoFocus: true,
source: function (request, response) {
$.ajax({
url: "http://localhost/jqueryuiapp.service/api/flowcard/getlist",
data: { sku: request.term },
dataType: "json",
success: function (data) {
response(data);
}
});
},
minLength: 3,
select: function (event, ui) {
if (ui.item != null) {
$('#txt_Sku').val(ui.item.SKU);
$('#txt_BatchNo').val(ui.item.BatchNo);
$('#txt_GroupNo').val(ui.item.GroupNo);
} return false;
}
,
focus: function (event, ui) {
$('#txt_Sku').val(ui.item.SKU);
return false;
}
}).autocomplete("instance")._renderItem = function (ul, item) {
return $('<table></table>')
.data("item.autocomplete", item)
.append('<tr><td style="width:140px;">' + item.SKU + '</td><td style="width:50px;"> ' + item.BatchNo + '</td><td style="width:60px;"> ' + item.GroupNo + "</td></tr>")
.appendTo(ul); };
};
</script>
</head>
<body>
SKU:<input id="txt_Sku" width="200" /><br />
批次:<input id="txt_BatchNo" width="200" /><br />
版号:<input id="txt_GroupNo" width="200" />
</body>
</html>

后台:

using System.Runtime.Serialization;

namespace JQueryUIApp.Model
{ [DataContract]
public class FlowcardModel
{
[DataMember]
public string SKU { get; set; }
[DataMember]
public string BatchNo { get; set; }
[DataMember]
public string GroupNo { get; set; }
}
}
using System.Collections.Generic;
using System.Web.Http;
using JQueryUIApp.Model; namespace JQueryUIApp.Service.Controllers
{
public class FlowCardController : ApiController
{
public List<FlowcardModel> GetList()
{
var list = new List<FlowcardModel>();
list.Add(new FlowcardModel() { SKU = "", BatchNo = "P01", GroupNo = "" });
list.Add(new FlowcardModel() { SKU = "", BatchNo = "P01", GroupNo = "" });
list.Add(new FlowcardModel() { SKU = "", BatchNo = "P01", GroupNo = "" });
return list;
}
}
}

最新文章

  1. jQuery源码学习感想
  2. Xamarin迁移到 Unified API 注意事项
  3. android 电容屏(一):电容屏基本原理篇
  4. How to Run Node.js with Express on Mobile Devices
  5. cocos2d-x学习之类型转换(转)
  6. Spark Streaming Backpressure分析
  7. 无奈而又苦逼的二分版本号回退法定位新引入的bug!!!
  8. C语言程序的三种基本结构
  9. oralce set
  10. 搭建vue开发环境及各种报错处理
  11. 布衣之路(一):VMware虚拟机+CentOS系统安装
  12. 【XSY3139】预言家 数位DP NFA
  13. django学习:整体思路与方向
  14. python进程间通信
  15. 在Salesforce中使用静态资源
  16. 【BZOJ4946】[NOI2017]蔬菜(贪心)
  17. linux dns 工具包 -- bind-utils
  18. sqlite基本操作
  19. KbmMW 4.50.00 测试版发布
  20. [leetcode-897-Increasing Order Search Tree]

热门文章

  1. DOM创建和删除节点
  2. bzoj 3196二逼平衡树 线段树套平衡树
  3. wiki 2490 导弹拦截塔
  4. 【Sqlite3】SQLITE3使用总结(转)
  5. Linux下进程描述(1)—进程控制块【转】
  6. 两个kernel.org国内镜像
  7. Google I/O完整盘点,这才是地球上最「性感」的发布会
  8. jQuery鼠标悬停文字渐隐渐现动画效果
  9. php7安装及和php5的共存
  10. 移植WordPress到Ubuntu16.04