从本地读取数据:
<HTML>
<HEAD>
<TITLE>使用EXT输出HelloWorld</TITLE>
<!-- 导入extjs配置 … ... -->
<link rel="stylesheet" type="text/css" href="./../ext/resources/css/ext-all.css"/>
<script type="text/javascript" src="./../ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="./../ext/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL='./../ext/resources/images/default/s.gif';
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
var store = new Ext.data.SimpleStore({
fields:['province','post'],
data: [['北京','100000'],['通县','101100'],['昌平','102200'],
['大兴','102600'],['密云','101500'],['延庆','102100'],
['顺义','101300'],['怀柔','101400'],['北理','101200']]
});
var form = new Ext.form.FormPanel({
title: 'Ext.form.ComboBox本地数据源示例',
height: 100,
width: 270,
frame: true,
labelSeparator: ':',
labelWidth: 80,
bodyStyle: 'padding:5 5 5 5',
applyTo: 'form',
items:[
new Ext.form.ComboBox({
id: 'post',
fieldLabel: '邮政编码',
triggerAction: 'all', //单机触发按钮显示全部数据
store: store, //设置数据源
displayField: 'province', //定义要显示的字段
valueField: 'post', //定义值字段
mode: 'local', //本地模式
forceSelection: true, //要求输入值必须在列表中存在
resizable:true, //允许改变下拉列表的大小
typeAhead: true, //允许自动选择匹配的剩余部分文本
value: 102600, //默认选择大兴
handleHeight: 10 //下拉列表中拖动手柄的高度
})
]
});
});
</script>
</HEAD>
<body id="form">
</body>
</HTML>
7万+

被折叠的 条评论
为什么被折叠?



