当前位置: 代码迷 >> Web前端 >> EXT-Ext.form.field.Trigger示范
  详细解决方案

EXT-Ext.form.field.Trigger示范

热度:863   发布时间:2013-10-23 11:39:13.0
EXT--Ext.form.field.Trigger示例
<!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> 

?

  相关解决方案