81,092
社区成员
发帖
与我相关
我的任务
分享
<script>
Ext.BLANK_IMAGE_URL = "resources/images/default/s.gif";
Ext.QuickTips.init();
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.onReady(function(){
var formPanel = new Ext.FormPanel({
id:"formTest",
title:"从后台加载数据",
width:400,
height:300,
renderTo:'panel',
// fields:['id','name','memo'],
reader: new Ext.data.JsonReader(
[
{
name: 'id',
mapping:'name/id',
type:'string'
},
{
name: 'name',
mapping:'name/name',
type:'string'
},
{
name: 'memo',
mapping:'name/memo',
type:'string'
}
]),
items:[
{
xtype:'textfield',
width:200,
fieldLabel : '编号',
name : 'id',
allowBlank : false
}, {
xtype:'textfield',
width:200,
fieldLabel : '名称',
name : 'name',
allowBlank : false
}, {
xtype:'textfield',
width:200,
fieldLabel : '备注',
name:'memo'
}
],
buttons:[
{
text:"加载数据",
listeners:{
click:function(){
loadData();
}
}
},
{
text:"提交"
},
{
text:"重置"
}
]
});
function loadData(){
Ext.getCmp("formTest").load({
url: "<%=path%>/loadData.do",
params: {param1: "foo", param2: "bar"} // 将参数传入到 URL 中
// callback: yourFunction, 回调函数
// scope: yourObject, // optional scope for the callback
/* discardUrl: false,
nocache: false,
text: "Loading...",
timeout: 10,
scripts: false */
})
}
})
</script>