现在的位置: 主页 > 公司荣誉 > 文章正文

ExtJS 2.0 tips

作者:陕西芙爱尔婚庆礼仪服务有限公司 来源:www.fair521.com 未知发布时间:2017-09-04 13:28:48
ExtJS 2.0 tips

初始化头部
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript" src="../../ext2/source/locale/ext-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="../../ext2/resources/css/ext-all.css" />
<script type="text/javascript" src="../../ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext2/ext-all.js"></script>

GridPanel加载远程json数据
var labs = new Ext.data.JsonStore({
url: 'http://127.0.0.1:8080/LabShiftPrj/bookAction!getBookLabs.action?userName=' + Ext.get("userName").getValue(),
fields: ['index' , 'value'],
autoLoad: true,
root: 'labs',
method: 'post'
//data: {"labs":[{"index":1,"value":"LAB-CMP-1"},{"index":2,"value":"LAB-CMP-2"},{"index":3,"value":"LAB-PHY-1"}]}
});

var g = new Ext.grid.GridPanel({
renderTo: document.body,
frame: true,
title: '已预定实验室',
height: 200,
width: 500,
store: labs,
columns: [
{header: '编号' , dataIndex: 'index' , sortable: true},
{header: '实验室' , dataIndex: 'value' , sortable: true}
],
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: {
fn: function(sm ,index ,record){
Ext.Msg.alert(record.data.value);
}
}
}})
});

FormPanel实例
var fm = new Ext.FormPanel({
renderTo: document.body,
frame: true,
title: 'register',
width: 500,
items: [
{
xtype: 'textfield',
fieldLabel: 'Name',
name: 'name',
vtype: 'alpha'
},
{
xtype: 'timefield',
fieldLabel: 'Date',
name: 'd'
},
{
xtype: 'radio',
fieldLabel: 'Sex',
name: 's',
boxLabel: 'Male'
},
{
xtype: 'radio',
name: 's',
boxLabel: 'Female',
fieldLabel: '',
labelSeperator: ''
},
{
xtype: 'checkbox',
name: 'join',
fieldLabel: 'Join'
},
{
xtype: 'combo',
name: 'city',
fieldLabel: 'City',
store: cities,
mode: 'local',
displayField: 'value',
width: '120'
},
{
xtype: 'textarea',
name: 'description',
fieldLabel: 'Description',
width: 300
}
],
buttons: [
{
text: 'OK',
handler: function()
{
Ext.Ajax.request({
url: 'www.126.com',
params: {
name:fm.getForm().findField('name').getValue(),
date:fm.getForm().findField('description').getValue()
},
success: function(response, options) {
Ext.Msg.alert('success');
},
failure: function(response , options){
Ext.Msg.alert("fail");
}
});
}
},
{
text: 'CANCEL',
handler: function()
{
fm.getForm().reset();
}
}
]
});

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:孝感SEO http://xiaogan.raoyu.net

上一篇:[Cocos2D]如何创建Cocos2D-X的项目(版本号2.2) 下一篇:最后一页