zoukankan      html  css  js  c++  java
  • jquery autoComplete的使用代码一则

    $(function() {
    		$("#vipCustomer").autocomplete({
    			source : function(request, response) {
    				$.ajax({
    					type : "post",
    					url : "${basePath}AutoComplete.htm",
    					dataType : "json",
    					data : {
    						text_search : request.term
    					},
    					success : function(data) {
    						if (data.rows.length == 0) {
    							autoCompleteSuccess = false;
    							var result = [ {
    								label : "无与"" + request.term + ""匹配的客户信息,请新建客户信息",
    								value : "NoMatch"
    							} ];
    							response($.map(result, function(item) {
    								return {
    									label : item.label,
    									value : '',
    									id : item.value
    								}
    							}));
    						} else {
    							autoCompleteSuccess = true;
    							response($.map(data.rows, function(item) {
    								return {
    									label : item.name,
    									value : item.name,
    									id : item.id,
    									serialNumber : item.serialNumber
    								}
    							}));
    						}
    					}
    				});
    			},
    			minLength : 1,
    			select : function(event, ui) {
    				if (ui.item.id == 'NoMatch') {
    					toAddVipCustomerInfo();
    				} else {
    					createTable(ui.item);
    				}
    			},
    			open : function() {
    				$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
    			},
    			close : function() {
    				$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
    			}
    		});
    	});
    

      

  • 相关阅读:
    如何实现EndNote中的PDF批量导出
    UltraEdit 编译输出中文乱码的解决办法
    史密斯(smith)圆图讲解
    OpenFlow
    网络虚拟化-简介
    java util包概述
    内存四区分析
    理解Java接口
    Ubuntu14.04安装wineqq国际版
    使用注解来构造IoC容器
  • 原文地址:https://www.cnblogs.com/flying607/p/3559258.html
Copyright © 2011-2022 走看看