FineUI 官方论坛
标题:
数据缓存做输入框提示
[打印本页]
作者:
缘缘
时间:
2016-5-6 17:22
标题:
数据缓存做输入框提示
<head
runat
=
"server"
>
<title></title>
<link
href
=
"../../res/css/common.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<link
rel
=
"stylesheet"
href
=
"../res/jqueryuiautocomplete/jquery-ui.min.css"
/>
<link
rel
=
"stylesheet"
href
=
"../res/jqueryuiautocomplete/theme-start/theme.css"
/>
<style>
.
ui
-
autocomplete
-
loading
{
background
:
white url
(
'../../res/images/ui-anim_basic_16x16.gif'
)
right center
no
-
repeat
;
}
</style>
</head>
<body>
<form
id
=
"form1"
runat
=
"server"
>
<f
ageManager
ID
=
"
ageManager1"
runat
=
"server"
/>
<f:SimpleForm
ID
=
"SimpleForm1"
runat
=
"server"
LabelWidth
=
"60px"
Width
=
"600px"
BodyPadding
=
"5px"
EnableCollapse
=
"true"
Title
=
"简单表单"
>
<Items>
<f:TextBox
ID
=
"TextBox1"
runat
=
"server"
Label
=
"标题"
EmptyText
=
"输入字母 ja 或者 sc 试试,必须输入两个字符后才有自动提示"
>
</f:TextBox>
</Items>
</f:SimpleForm>
<br
/>
参考:
http://jqueryui.com/autocomplete/#remote-with-cache
</form>
<script
src
=
"../../res/js/jquery.min.js"
type
=
"text/javascript"
></script>
<script
src
=
"../res/jqueryuiautocomplete/jquery-ui.min.js"
type
=
"text/javascript"
></script>
<script
type
=
"text/javascript"
>
var
textbox1ID
=
'<%= TextBox1.ClientID %>'
;
F
.
ready
(
function
()
{
var
cache
=
{};
$
(
'#'
+
textbox1ID
+
' input'
).
autocomplete
({
minLength
:
2
,
source
:
function
(
request
,
response
)
{
var
term
=
request
.
term
;
if
(
term in cache
)
{
response
(
cache
[
term
]);
return
;
}
$
.
getJSON
(
"search.ashx"
,
request
,
function
(
data
,
status
,
xhr
)
{
cache
[
term
=
data
;
response
(
data
);
});
}
});
});
</script>
</body>
[size=13.3333px]
[size=13.3333px]这是官网的例子,但是没有给一般处理程序的代码,不知道如何处理的有会的么请指导一下
作者:
缘缘
时间:
2016-5-6 17:23
自己顶一下
作者:
sanshi
时间:
2016-5-6 21:42
下载官网示例全部源代码:
http://pan.baidu.com/s/1bntUOr1
作者:
缘缘
时间:
2016-5-9 08:59
三石老师,我想做自动补全的呢个,输入字母,提示的是汉字补全怎做啊,就像百度或其他搜索呢样,输入的是拼音一样提示的是汉字
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4