-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAutoCompleteMulti.js
More file actions
702 lines (567 loc) · 26.7 KB
/
AutoCompleteMulti.js
File metadata and controls
702 lines (567 loc) · 26.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
/**
* 实现自动完成功能的js类
* 1、数据获取方式:设置静态数据集、ajax方式、自定义数据获取函数
* 2、可以控制是否启用匹配项的循环选择
* 3、可以控制是否使用默认静态数据集,在获取动态数据失败的情况下会显示
* 4、支持多关键词自动完成
* Created by zhaojinghao on 2014-7-7.
* Updated by zhaojinghao on 2014-7-31
* Update content:添加了在输入框中输入多个关键词的自动完成功能,自动识别当前正在输入的关键词,需要设置关键词分隔符,默认为空格
* 通过将commonObj提升为特权变量,修正了同一个页面中多个控件自动完成的冲突问题
* 为了尽量保持原有类的封闭性,将新增内容封装在KeywordRange类中,这样原有类只需修改少量代码
* Updated by 赵晶浩 on 2014-8-04
* Update content:多关键词匹配时,当用户选中某个匹配项后,自动将光标定位在该关键词后面
*/
(function() {
var is_IE = (navigator.appName == "Microsoft Internet Explorer");
/**
* 多关键词输入的情况下,用来处理keyword的内部类
* @inputString 输入字符串
* @separator 关键词分隔符
* @constructor
*/
function KeywordRange(inputString, separator) {
//输入字符串
this.input = inputString || "";
//关键词分隔符,默认为空格
this.separator = separator || " ";
//光标位置
this.cursorPosition = -1;
/**
* 计算光标位置
*/
this.getCursorPosition = function(domObj) {
var position = 0;
if (document.selection) { //for IE
domObj.focus();
var sel = document.selection.createRange();
sel.moveStart('character', -domObj.value.length);
position = sel.text.length;
} else if (domObj.selectionStart || domObj.selectionStart == '0') {
position = domObj.selectionStart;
}
return position;
};
/**
* 通过光标位置,计算当前正在输入的关键词及其起始位置与长度
* @param str
* @param cursorPosition
* @returns {{start: number, length: (*|Number|number|length)}}
*/
this.calcKeywordInfo = function(str, cursorPosition, separator) {
var strs = str.split(separator);
var length = strs.length;
var currPosition = 0;
for (var index = 0; index < length; index++) {
currPosition += strs[index].length + separator.length;
if (currPosition >= cursorPosition + 1) {
return {
currKeyword: strs[index],
start: currPosition - strs[index].length - separator.length,
length: strs[index].length
};
} //end if
} //end for
} //end getPrePosition
/**
* 获取当前正在输入的关键词
*/
this.getCurrentKeyword = function(obj) {
var cursorP; //= this.getCursorPosition(obj); //this.cursorPosition; ie用
if (is_IE) {
cursorP = this.cursorPosition;
}
else {
cursorP = this.getCursorPosition(obj);
}
var result = this.calcKeywordInfo(this.input, cursorP, this.separator);
if (result) {
return result.currKeyword
}
else {
return "";
}
};
/**
* 根据用户选择的匹配结果,计算输入字符串
*/
this.getCompleteInputString = function(obj, inputContent, selectedKeyword) {
var cursorP; // = this.getCursorPosition(obj); //this.cursorPosition; ie用
if (is_IE) {
cursorP = this.cursorPosition;
}
else {
cursorP = this.getCursorPosition(obj);
}
var result = this.calcKeywordInfo(inputContent, cursorP, this.separator);
var fstStr = inputContent.substring(0, result.start);
var lstStr = inputContent.substring(result.start + result.length);
return fstStr + selectedKeyword + lstStr;
//return this.input.replace(result.currKeyword, selectedKeyword);
};
/**
* 设置自动完成输入字符串,并将光标定位在当前关键字的最后
*/
this.setAutoCompleteString = function(obj, inputContent, selectedKeyword) {
var cursorP; // = this.getCursorPosition(obj); //this.cursorPosition; ie用
if (is_IE) {
cursorP = this.cursorPosition;
}
else {
cursorP = this.getCursorPosition(obj);
}
var result = this.calcKeywordInfo(inputContent, cursorP, this.separator);
var str = this.getCompleteInputString(obj, inputContent, selectedKeyword);
obj.value = str;
this.setCursorPosition(obj, result.start + selectedKeyword.length);
};
/**
* 设置输入框光标位置
*/
this.setCursorPosition = function(ctrl, pos) {
//设置光标位置函数
if (ctrl.setSelectionRange) {
ctrl.focus();
ctrl.setSelectionRange(pos, pos);
} else if (ctrl.createTextRange) {
var range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
} //end setCursorPosition
} //end KeywordRange
/**
* 构造函数
* @param option
* @constructor
*/
function AutoComplete(option) {
//需要实现自动完成功能的页面控件ID
this.controlId = option.controlId;
//匹配结果div的id
this.resultDivId = option.resultDivId;
//当前选中的项索引,第一项索引为0
this.index = -1;
//是否支持多关键字自动完成
this.hasMultiKeyword = option.hasMultiKeyword || "false";
//开启多关键字自动完成时,需要设置关键字分隔符,默认为空格
this.separator = option.separator || " ";
//静态数据集
this.datas = option.datas;
//动态获取的数据集
this.dynamicDatas = null;
//服务器端地址
this.serverUrl = option.serverUrl;
//匹配结果集合
this.resultDatas = null;
//ajax请求数据
this.ajaxRequestData = option.ajaxRequestData;
//主要用在一个后台页面处理多个前端自动完成请求的情况,根据此字段调用具体的后台方法
this.actionName = option.actionName;
//是否可以循环选择
this.circleChoose = option.circleChoose || "true";
//是否从服务器端获取数据
this.serverEnabled = option.serverEnabled || "false";
//是否使用静态数据
//一般情况下,自动完成都是获取动态数据的,开启这个标志后,在获取动态数据失败的情况下会使用静态数据,默认为false
this.useStaticDatas = option.useStaticDatas || "false";
//驱动函数
this.drivenFuc = null;
//自定义数据获取方法
this.getCompleteDatas = function() {
if (typeof option.getCompleteDatas === 'function') {
return option.getCompleteDatas();
}
else {
return null;
}
};
//初始化多关键词处理对象
this.keywordHandler = new KeywordRange("", this.separator);
//私有变量,封装后面常用的4个变量
//var commonObj = {};
//通过匿名函数来构造一个类似面向对象语言中的只读属性
//初始化commonObj变量
//注意:匿名函数中的this指向windows对象,这里需要将AutoComplete对象的引用赋值给that
this.commonObj = {
control: document.getElementById(this.controlId),
results: document.getElementById(this.resultDivId),
jControl: $(document.getElementById(this.controlId)),
jResults: $(document.getElementById(this.resultDivId))
};
/**
* 获取关键词
*/
this.getKeyword = function() {
if (this.hasMultiKeyword == "true") {
this.keywordHandler.input = this.commonObj.jControl.val();
return this.keywordHandler.getCurrentKeyword(this.commonObj.control);
}
else {
return this.commonObj.jControl.val();
}
} //end getKeyword
//只读属性
/*this.getCommonObj = function(){
return commonObj;
}*/
}
/**
* 原型方法
*/
AutoComplete.prototype = {
//指定构造函数
constructor: AutoComplete,
init: function() {
var autoThisObj = this;
document.onclick = function(event) {
//$("#"+resultDivId).hide();
var target = autoThisObj.getTarget(autoThisObj.getEvent(event));
//alert(target.id);
if (target.id == autoThisObj.controlId) {
return false;
}
autoThisObj.clearResults(autoThisObj);
}
autoThisObj.keyDownBind(autoThisObj, autoThisObj.commonObj.jResults);
//兼容ie(ie浏览器下,当按下up与down键时,输入框会失去焦点,导致up与down键不起作用)
this.commonObj.jResults.attr('tabindex', 1).bind("keydown", function(event) {
$(this).focus();
return false;
});
//给指定控件绑定keyup事件
$("#" + autoThisObj.controlId).bind("keyup", function(event) {
var e = autoThisObj.getEvent(event);
var keyCode = e.keyCode;
if ((keyCode == '40' || keyCode == '38' || keyCode == '37' || keyCode == '39' || keyCode == '13' || keyCode == '9')) {
return false;
}
autoThisObj.index = -1;
autoThisObj.commonObj.results.scrollTop = 0;
autoThisObj.keywordHandler.input = autoThisObj.commonObj.jControl.val();
//alert(commonObj.control.id);
var keyword = autoThisObj.getKeyword();
if (keyword.length == 0) {
//jResults.hide();
autoThisObj.clearResults(autoThisObj);
return;
}
//获取动态数据集,自定义函数的优先级最高
var autoDatas = autoThisObj.getCompleteDatas(); //调用自定义数据获取函数
if ((autoDatas instanceof Array) && (autoDatas.length > 0)) {
autoThisObj.dynamicDatas = autoDatas;
autoThisObj.generateHtml(autoThisObj, autoThisObj.dynamicDatas);
autoThisObj.navigate(autoThisObj);
}
else if (autoThisObj.serverEnabled == "true") { //服务器端获取数据
autoThisObj.getAjaxDatas(autoThisObj, keyword);
return;
}
if(!(autoDatas instanceof Array) && autoThisObj.useStaticDatas == "true" && autoThisObj.datas.length > 0){
autoThisObj.generateHtml(autoThisObj, autoThisObj.datas);
autoThisObj.navigate(autoThisObj);
}
}); //end keyup()
}, // end init()
//获取事件对象
getEvent: function() {
var ev = window.event || arguments[0]; //IE,chrome //event ? event : window.event;
if (!ev) { //firefox
var c = this.getEvent.caller;
while (c) {
ev = c.arguments[0];
if (ev && (Event == ev.constructor || MouseEvent == ev.constructor)) {
break;
}
c = c.caller;
}
}
return ev;
},
//获取事件源
getTarget: function(event) {
return event.target || event.srcElement;
},
/**
* 计算div的偏移量
* @param obj
* @returns {{left: (Number|number), top: (Number|number)}}
*/
getOffset: function(obj) {
var x = obj.offsetLeft || 0;
var y = obj.offsetTop || 0;
var temp = obj;
while (temp.offsetParent) {
temp = temp.offsetParent;
x += temp.offsetLeft;
y += temp.offsetTop;
}
//alert("x:"+x+" y:"+y);
return { left: x, top: y };
},
/**
* 将tagetDiv定位到sourceDiv下方,与sourceDic左对齐,宽度一致
* @param sourceDiv
* @param targetDiv
*/
positionDiv: function(sourceDiv, targetDiv) {
var obj = document.getElementById(sourceDiv);
var xy = this.getOffset(obj);
$("#" + targetDiv).css("left", xy.left);
$("#" + targetDiv).css("width", $("#" + sourceDiv).outerWidth());
$("#" + targetDiv).css("top", (xy.top + $("#" + sourceDiv).outerHeight()));
},
/**
* 定义 up与down 按键功能
* @param event
* @param objectId
* @returns {boolean}
*/
navigate: function(autoThisObj) {
this.keyDownBind(this, this.commonObj.jControl);
}, // end navigate()
/**
* 给指定jquery元素绑定keydown事件,使其可以进行匹配项的选择
*/
keyDownBind: function(autoThisObj, jObject) {
var autoThisObj = this;
jObject.unbind("keydown");
jObject.keydown(function() {
//兼容ie
if (is_IE) {
if (this.id == autoThisObj.commonObj.control.id) {
autoThisObj.keywordHandler.cursorPosition = autoThisObj.keywordHandler.getCursorPosition(autoThisObj.commonObj.control);
}
}
var e = autoThisObj.getEvent();
var key = e.keyCode;
if (i == "" || !i)
i = -1;
else
i = parseFloat(i);
var itemCount = autoThisObj.commonObj.results.childNodes.length;
if (key == '40') //Down
{
autoThisObj.commonObj.jResults.focus();
for (var i = 0, len = itemCount; i < len; i++) { //重置
if (i % 2 == 0) {
autoThisObj.commonObj.results.childNodes[i].className = "item_even";
}
else {
autoThisObj.commonObj.results.childNodes[i].className = "item_odd";
}
}
autoThisObj.index++;
if (autoThisObj.index > itemCount - 1) {
if (autoThisObj.circleChoose == "true") {
autoThisObj.index = 0;
autoThisObj.commonObj.jResults.scrollTop(0);
}
else {
autoThisObj.index = itemCount - 1;
}
}
try {
autoThisObj.commonObj.results.childNodes[autoThisObj.index].className = "item_even chooseItem";
autoThisObj.commonObj.results.childNodes[autoThisObj.index - 1].className = (autoThisObj.index + 1) % 2 == 0 ? "item_even" : "item_odd";
}
catch (e) {
}
//以下两个判断语句用来将当前选中项置于div的可视范围内 padding*2+borderwidth = 2*2+1=5
if (($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index + 1) > autoThisObj.commonObj.jResults.scrollTop() + parseInt(autoThisObj.commonObj.results.style.height)) {
autoThisObj.commonObj.jResults.scrollTop(($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index + 1) - parseInt(autoThisObj.commonObj.results.style.height));
}
if (($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index) < autoThisObj.commonObj.jResults.scrollTop()) {
autoThisObj.commonObj.jResults.scrollTop(($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index));
}
return false;
}
else if (key == '38') //UP
{
autoThisObj.commonObj.jResults.focus();
for (var i = 0, len = itemCount; i < len; i++) { //重置
if (i % 2 == 0) {
autoThisObj.commonObj.results.childNodes[i].className = "item_even";
}
else {
autoThisObj.commonObj.results.childNodes[i].className = "item_odd";
}
}
autoThisObj.index--;
if (autoThisObj.index < 0) {
autoThisObj.index = 0;
if (autoThisObj.circleChoose == "true") {
autoThisObj.index = itemCount - 1;
autoThisObj.commonObj.results.scrollTop = autoThisObj.commonObj.results.scrollHeight;
}
else {
autoThisObj.index = 0;
}
}
try {
autoThisObj.commonObj.results.childNodes[autoThisObj.index].className = "item_even chooseItem";
autoThisObj.commonObj.results.childNodes[autoThisObj.index + 1].className = (autoThisObj.index + 1) % 2 == 0 ? "item_even" : "item_odd";
}
catch (e) {
}
//以下两个判断语句用来将当前选中项置于div的可视范围内
if (($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index + 1) > autoThisObj.commonObj.jResults.scrollTop() + parseInt(autoThisObj.commonObj.results.style.height)) {
autoThisObj.commonObj.jResults.scrollTop(($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index + 1) - parseInt(autoThisObj.commonObj.results.style.height));
}
if (($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index) < autoThisObj.commonObj.jResults.scrollTop()) {
autoThisObj.commonObj.jResults.scrollTop(($(autoThisObj.commonObj.results.childNodes[autoThisObj.index]).height() + 5) * (autoThisObj.index));
}
return false;
}
else if (key == '13' || key == '9') // enter/tab
{
if (autoThisObj.index == -1)
autoThisObj.index = 0;
if (autoThisObj.hasMultiKeyword == "true") {
//autoThisObj.commonObj.jControl.val(autoThisObj.keywordHandler.getCompleteInputString(autoThisObj.commonObj.control, $.trim(autoThisObj.commonObj.jControl.val()), autoThisObj.commonObj.results.childNodes[autoThisObj.index].innerHTML));
autoThisObj.keywordHandler.setAutoCompleteString(autoThisObj.commonObj.control, autoThisObj.commonObj.jControl.val(), autoThisObj.commonObj.results.childNodes[autoThisObj.index].innerHTML);
}
else {
autoThisObj.commonObj.jControl.val(autoThisObj.commonObj.results.childNodes[autoThisObj.index].innerHTML);
}
autoThisObj.clearResults(autoThisObj);
return false;
}
else {
return;
}
}); // end keydown
},
/**
* ajax方式获取匹配结果集
*/
getAjaxDatas: function(autoThisObj, keyword) {
var autoThisObj = this;
var jsonData = { keyword: keyword, type: autoThisObj.actionName }; // ajaxRequestData
$.ajax({
url: autoThisObj.serverUrl,
data: jsonData,
type: "POST",
success: function(returnValue) {
if (returnValue.length > 0) {
autoThisObj.dynamicDatas = returnValue.split(',');
}
else {
autoThisObj.dynamicDatas = null;
autoThisObj.clearResults(autoThisObj);
return;
}
//
if (autoThisObj.dynamicDatas != null) {
autoThisObj.generateHtml(autoThisObj, autoThisObj.dynamicDatas);
}
else if (autoThisObj.useStaticDatas == "true" && autoThisObj.datas.length > 0) {
autoThisObj.generateHtml(autoThisObj, autoThisObj.datas);
}
autoThisObj.navigate(autoThisObj);
}, //end success()
error:function(){
if (autoThisObj.useStaticDatas == "true" && autoThisObj.datas.length > 0) {
autoThisObj.generateHtml(autoThisObj, autoThisObj.datas);
autoThisObj.navigate(autoThisObj);
}
} //end error
}); //end ajax()
},
/**
* 获取数据后生成html,并绑定基本事件
*/
generateHtml: function(autoThisObj, datas) {
//var commonObj = this.getCommonObj();
var autoThisObj = this;
var length = datas.length;
var htmlStr = "";
if (length > 0) {
for (var i = 0; i < length; i++) {
if (i % 2 == 0) {
htmlStr += "<div class='item_even'>" + datas[i] + "</div>";
}
else {
htmlStr += "<div class='item_odd'>" + datas[i] + "</div>";
}
}
//htmlStr = "<div class='resultCss' id='"+ autoThisObj.resultDivId +"'>" + htmlStr + "</div>";
this.commonObj.jResults.html(htmlStr).show();
//计算单个item的高度
var itemHeight = $(".item_even").first().outerHeight();
if (length >= 10) {
this.commonObj.jResults.height(10 * itemHeight);
}
else {
this.commonObj.jResults.height(length * itemHeight);
}
//调整结果div的宽度并定位
this.positionDiv(autoThisObj.controlId, autoThisObj.resultDivId);
//默认选中第一项
autoThisObj.index = 0;
this.commonObj.results.childNodes[autoThisObj.index].className = "item_even chooseItem";
//给结果集中的每一项添加基本事件
this.commonObj.jResults.find("[class^='item']").each(function() {
//点击事件
$(this).on("click", function() {
autoThisObj.commonObj.jResults.focus();
if (autoThisObj.hasMultiKeyword == "true") {
//autoThisObj.commonObj.jControl.val(autoThisObj.keywordHandler.getCompleteInputString(autoThisObj.commonObj.control, $.trim(autoThisObj.commonObj.jControl.val()), $(this).html()));
autoThisObj.keywordHandler.setAutoCompleteString(autoThisObj.commonObj.control, autoThisObj.commonObj.jControl.val(), $(this).html());
autoThisObj.clearResults(autoThisObj);
return false;
}
else {
autoThisObj.commonObj.jControl.val($(this).html());
}
autoThisObj.clearResults(autoThisObj);
});
//mouseover事件
$(this).mouseover(function() {
autoThisObj.index = $(this).index();
var results = document.getElementById(autoThisObj.controlId);
var itemCount = document.getElementById(autoThisObj.resultDivId).childNodes.length;
for (var i = 0, len = itemCount; i < len; i++) {
document.getElementById(autoThisObj.resultDivId).childNodes[i].className = i % 2 == 0 ? "item_even" : "item_odd"; //重置
}
document.getElementById(autoThisObj.resultDivId).childNodes[autoThisObj.index].className = "item_even chooseItem";
});
});
}
else {
this.clearResults(autoThisObj);
}
},
/**
* 清空结果div
*/
clearResults: function(autoThisObj) {
var results = document.getElementById(autoThisObj.resultDivId);
var jResults = $(results);
results.innerHTML = "";
jResults.scrollTop(0);
results.style.display = "none";
jResults.css("height", "auto");
autoThisObj.dynamicDatas = null;
autoThisObj.index = 0;
autoThisObj.keywordHandler.cursorPosition = -1;
},
//重置结果集
resetResults: function(autoThisObj) {
var results = document.getElementById(this.resultDivId);
var jResults = $(results);
this.commonObj.jResults.scrollTop(0);
results.style.display = "none";
autoThisObj.index = 0;
var itemCount = results.childNodes.length;
for (var i = 0, len = itemCount; i < len; i++) {
results.childNodes[i].className = "item"; //重置
}
results.childNodes[autoThisObj.index].className = "item chooseItem";
}
}
//将AutoComplete暴露到全局范围
window.AutoCompleteMulti = AutoComplete;
})();