-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathext-remote-data.html
More file actions
61 lines (61 loc) · 2.04 KB
/
Copy pathext-remote-data.html
File metadata and controls
61 lines (61 loc) · 2.04 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
<HTML>
<HEAD>
<TITLE>远程数据源的组合框示例</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="extjs4/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs4/bootstrap.js"></script>
<script type="text/javascript" src="extjs4/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
//创建数据模型
Ext.regModel('BookInfo', {
fields: [{name: 'bookName'}]
});
//定义组合框中显示的数据源
var bookStore = Ext.create('Ext.data.Store',{
model : 'BookInfo',
proxy: {
type: 'ajax',//Ext.data.AjaxProxy
url : 'bookSearchServer.jsp',
reader: new Ext.data.ArrayReader({model : 'BookInfo'})
}
});
//创建表单
Ext.create('Ext.form.Panel',{
title:'Ext.form.field.ComboBox远程数据源示例',
frame : true,
height:100,
width:270,
renderTo: Ext.getBody(),
bodyPadding: 5,
defaults:{//统一设置表单字段默认属性
labelSeparator :':',//分隔符
labelWidth : 70,//标签宽度
width : 200,//字段宽度
labelAlign : 'left'//标签对齐方式
},
items:[{
xtype : 'combo',
fieldLabel:'书籍列表',
listConfig : {
loadingText : '正在加载书籍信息',//加载数据时显示的提示信息
emptyText : '未找到匹配值',//当值不在列表是的提示信息
maxHeight : 100//设置下拉列表的最大高度为60像素
},
allQuery:'allbook',//查询全部信息的查询字符串
minChars : 3,//下拉列表框自动选择前用户需要输入的最小字符数量
queryDelay : 300,//查询延迟时间
queryParam : 'searchbook',//查询的名字
triggerAction: 'all',//单击触发按钮显示全部数据
store : bookStore,//设置数据源
displayField:'bookName',//定义要显示的字段
valueField:'bookName',//定义值字段
queryMode: 'remote'//远程模式
}]
});
});
</script>
</HEAD>
<BODY STYLE="margin: 10px">
</BODY>
</HTML>