52,797
社区成员
发帖
与我相关
我的任务
分享
systemformPanel = Ext.extend(Ext.form.FormPanel,{
_record : new Ext.data.Record.create(["name" , "address" ,"email","phone"]),
_store : new Ext.data.Store({
autoLoad:true,
//proxy:new Ext.data.HttpProxy({url:'http://localhost:8080/xml'}),
url:"http://localhost:8080/xml",
reader:new Ext.data.XmlReader({record:"person",id:'name'} ,this._record)
}),
constructor:function(){
systemformPanel.superclass.constructor.call(this, {
renderTo:Ext.getBody(),
frame:true,
width:392,
height:125,
title:'XmlReader Test',
labelAlign:'right',
store:this._store,
items:[{
layout:'column',
items:[{
columnWidth:.5,
layout:'form',
labelWidth:60,
items:[{
xtype:'textfield',
fieldLabel:'Name',
dataIndex:'name',
name:'name',
anchor:'95%'
},{
xtype:'textfield',
fieldLabel:'Address',
name:'address',
dataIndex:'address',
anchor:'95%'
}]
},{
columnWidth:.5,
layout:'form',
labelWidth:60,
items:[{
xtype:'textfield',
vtype:'email',
fieldLabel:'Email',
name:'email',
dataIndex:'email',
anchor:'95%'
},{
xtype:'textfield',
fieldLabel:'Phone',
name:'phone',
dataIndex:'phone',
anchor:'95%'
}]
}]
}],
buttons:[{
text:'OK',
handler:this.onSubmitClick,
scope:this,
},{
text:'Rest',
}]
});
/*this._store.on("load",function(obj){
alert(obj.getCount());
})
this._store.load();*/
},
onSubmitClick:function(){
alert(this._store.getCount());
},
setValues:function(){
},
});
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<person>
<name>AAAAAA</name>
<address>BBBBBBB</address>
<email>ggggg@163.com</email>
<phone>jglhjkhfjklhgfg</phone>
</person>
</dataset>
<!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=utf8">
<h1><title>XmlReader Test</title></h1>
<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" charset='utf8'></script>
<script type="text/javascript">
Ext.onReady(function(){
var _formPanel = new systemformPanel();
});
</script>
</head>
<body></body>
</html>