scroll
에 나는 UI/UX 관점에 대한 문제를 해결 설정할 수 있습니다. 각 필드에 사용할 수있는 옵션 수를 알려주는 백그라운드 함수가 있습니다. 이 정보를 사용하여 프로그래밍 방식으로 minlength 및 delay 옵션을 변경합니다. 나는 또한 focus 이벤트에 대한 함수를 bind/unbind하고 그것을 (thanks @Interstellar_Coder에게) 적절하게 스타일을 지정한다. 이렇게하면 사용자는 드롭 다운 목록과 관련된 즉각적인 응답을 얻을 수 있습니다.
아래는 내가하는 일의 간단한 버전입니다. 나는 버튼 클릭 이벤트를 사용하여 실제 응용 프로그램에서 프로그래밍 방식으로 수행중인 작업을 모방합니다.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<link href="CSS/smoothness/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
<style>
ul.ui-autocomplete
{
height: 100px;
overflow: auto;
}
</style>
</head>
<body>
<form id="form1" runat="server">
script type="text/javascript">
$(function() {
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
$("#tags").autocomplete({
source: availableTags,
minLength: 1
});
});
</script>
<script type="text/javascript">
function acdisplay() {
$("#tags").autocomplete("option", "minLength", 1);
$("#tags").autocomplete("option", "delay", 300);
$('#tags').unbind('focus');
}
function ddldisplay() {
$("#tags").autocomplete("option", "minLength", 0);
$("#tags").autocomplete("option", "delay", 0);
$("#tags").bind('focus', function(){
$(this).autocomplete("search", this.value);
});
}
</script>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
<input type="button" id="acDisplay" value="AutoComplete" onclick="acdisplay()" />
<input type="button" id="ddlDisplay" value="DropDownList" onclick="ddldisplay()" />
</div>
</form>
</body>
</html>
자동 완성을위한 콤보 박스 데모가 있습니다 (http://jqueryui.com/demos/autocomplete/#combobox). 그 부분적으로 귀하의 요구 사항을 충족합니까? –
아니요, 처음에는 백만 건의 레코드를 보유 할 수있는 드롭 다운 목록이 여전히 필요하기 때문입니다. – RWL01