<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ext.form.field.Trigger示例</title>
<link rel="stylesheet" href="ext-4.2.1/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-4.2.1/bootstrap.js"></script>
<script type="text/javascript" src="ext-4.2.1/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var testForm=new Ext.form.Panel({
title:'Trigger',
bodyStyle:'padding 5 5 5',
frame:true,
height:100,
width:270,
renderTo:'form',
defaults:{
labelSeparator:':',
labelwidth:70,
width:200,
labelAlign:'left'
},
items:[{
xtype:'triggerfield',
id:'memo',
fieldLabel:'触发字段',
hideTrigger:false, //不隐藏触发按钮
onTriggerClick:function(){
var memo=testForm.getForm().findField('memo');//取得输入控件 (注:memo是控件名)
alert(memo.getValue());//取得控件值
Ext.getCmp('memo').setValue('test');
}
}]
});
});
</script>
</head>
<body>
<form id="form" name="form">
<div name="memo"></div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ext.form.field.Trigger示例</title>
<link rel="stylesheet" href="ext-4.2.1/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-4.2.1/bootstrap.js"></script>
<script type="text/javascript" src="ext-4.2.1/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var testForm=new Ext.form.Panel({
title:'Trigger',
bodyStyle:'padding 5 5 5',
frame:true,
height:100,
width:270,
renderTo:'form',
defaults:{
labelSeparator:':',
labelwidth:70,
width:200,
labelAlign:'left'
},
items:[{
xtype:'triggerfield',
id:'memo',
fieldLabel:'触发字段',
hideTrigger:false, //不隐藏触发按钮
onTriggerClick:function(){
var memo=testForm.getForm().findField('memo');//取得输入控件 (注:memo是控件名)
alert(memo.getValue());//取得控件值
Ext.getCmp('memo').setValue('test');
}
}]
});
});
</script>
</head>
<body>
<form id="form" name="form">
<div name="memo"></div>
</form>
</body>
</html>