欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[ExtJs 2.02]Combobox的使用

程序员文章站 2022-07-13 23:10:32
...
1.简单使用:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ComboBox</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<link rel="stylesheet" type="text/css"
href="resources/css/ext-all.css" />
<script type="text/javascript" src="lib/ext-base.js"></script>
<script type="text/javascript" src="lib/ext-all.js"></script>
<script type="text/javascript"
src="lib/ext-lang-zh_CN.js"></script>

<script type="text/javascript">
Ext.onReady(function(){
var CountryCode = [
['93','Afghanistan(93)'],
['355','Albania (355)'],
['213','Algeria (213)'],
['684','American Samoa (684)'],
['376','Andorra (376)'],
['244','Angola (244)']
]
var cbb =new Ext.form.ComboBox({
el:'cbb',
emptyText:'请选择...',
fieldLabel: 'Country Code',
name:'Country Code',
forceSelection: true,
listWidth: 200,
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data : CountryCode
}),
valueField:'value',
displayField:'text',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,//用户不能自己输入,只能选择列表中有的记录
allowBlank:false
})
cbb.render();
});
</script>
</head>

<body>
<input id='cbb'/>
</body>
</html>

注意一下:这里的el对应的元素不是div 而是input
fieldLabel 元素在单独使用的时候没有作用,只有在form中起作用
相关标签: EXT HTML