87,993
社区成员
发帖
与我相关
我的任务
分享
systemformPanel = Ext.extend(Ext.form.FormPanel,{
_record : new Ext.data.Record.create(["name" , "address" ,"email","phone"]),
_store : new Ext.data.Store({
autoLoad:true,
url:"http://localhost:8080/xml",
reader:new Ext.data.XmlReader({record:"person"} ,this._record)
}),
constructor:function(){
systemformPanel.superclass.constructor.call(this, {
renderTo:Ext.getBody(),
frame:true,
width:692,
height:165,
bodyStyle:'padding:5px',
monitorValid:true,
layout:'form',
labelWidth:60,
title:'XmlReader Test',
labelAlign:'right',
store:this._store,
items:[{
xtype:'panel',
layout:'column',
fieldLabel:'Name',
isFormField:true,
items:[{//第一行
columsWidth:.5,
xtype:'textfield',
dataIndex:"name",
allowBlank:false,
blankText:'pls input',
width:230,
name:'name',
anchor:'90%',
},{
columnWidth:.999,
layout:'form',
labelWidth:78,
labelAlign:'right',
items:[{
xtype:'textfield',
fieldLabel:'Address',
dataIndex:"address",
allowBlank:false,
name:'address',
anchor:'95%'
}]
}]
},{//第二行
xtype:'panel',
layout:'column',
fieldLabel:'Email',
isFormField:true,
items:[{
columnWidth:.370,
xtype:'textfield',
dataIndex:"email",
allowBlank:false,
vtype:'email',
vtypeText:'格式错误~!',
name:'email',
anchor:'90%'
},{
columnWidth:.633,
layout:'form',
labelWidth:78,
items:[{
xtype:'textfield',
dataIndex:"phone",
name:'phone',
allowBlank:false,
fieldLabel:'Phone',
anchor:'95%'
}]
}]
},{//第三行
}],
buttons:[{
text:'OK',
handler:this.onSubmitClick,
scope:this,
}]
});
//this._store.load();
},
onSubmitClick:function(){
alert(this._store.getCount());
},
setValues:function(){
},
});
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<person>
<name>abcd</name>
<address>abcd</address>
<email>abcd@163.com</email>
<phone>1234567</phone>
</person>
</dataset>
<link rel="stylesheet" type="text/css" href="/js/ext/resources/css/ext-all.css" />
<script type="text/javascript" src="/js/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/js/ext/ext-all.js"></script>
<script type="text/javascript" src="/js/test.js" ></script>
<script type="text/javascript">
Ext.onReady(function(){
var _formPanel = new systemformPanel();
});
</script>