Extjs form加载问题
EXTjs 如何从grid行中跳转到另一个页面,自动加载form。
大家帮我看看我的代码有什么问题啊
js文件
form2 = new Ext.FormPanel( {
// formId:'updateForm',
labelWidth : 100,
renderTo:'form-ct',
frame : true,
title : 'Edit Data',
labelAlign:'right',
bodyStyle : 'padding:5px 5px 0',
width : 400,
waitMsgTarget : true,
// configure how to read the json Data
reader : new Ext.data.JsonReader({
successProperty: 'success',
root : 'itemVOList'
}, [
{name: 'itemVO.campaignFrom', mapping:'campaignFrom'}, // custom mapping
{name: 'itemVO.campaignTo', mapping:'campaignTo'},
{name: 'itemVO.dateFrom', mapping:'dateFrom',dateFormat:'Y-m-d'},
{name: 'itemVO.dateTo', mapping:'dateTo',dateFormat:'Y-m-d'},
{name: 'itemVO.itemClass', mapping:'itemClass'},
{name: 'itemVO.lineNumber', mapping:'lineNumber'},
{name: 'itemVO.price', mapping:'price'},
{name: 'itemVO.SKU', mapping:'SKU'},
{name: 'itemVO.description', mapping:'description'}
]),
defaults : {
width : 230
},
defaultType : 'textfield',
items : [
{
fieldLabel : 'campaignFrom',
name : 'itemVO.campaignFrom',
text:'dddddddddd',
allowBlank : false
}, {
fieldLabel : 'campaignTo',
name : 'itemVO.campaignTo',
allowBlank : false
},{
xtype: 'datefield',
format: 'Y-m-d',
name : 'itemVO.dateFrom',
fieldLabel: 'Date From'
},{
xtype: 'datefield',
format: 'Y-m-d',//format: 'Y-m-d H:i:s',
name : 'itemVO.dateTo',
fieldLabel: 'Date To'
},{
xtype: 'combo',
name: 'itemVO.itemClass',
fieldLabel: 'Item Class'
},{
name: 'itemVO.lineNumber',
fieldLabel: 'Line number'
},{
name: 'itemVO.price',
fieldLabel: 'price'
},
{
fieldLabel : 'SKU',
name : 'itemVO.SKU'
// allowBlank : false
}, {
xtype: 'textarea',
fieldLabel : 'description',
name : 'itemVO.description'
// allowBlank : false
}],
buttons : [ {
text : 'Submit Edit',
disabled : false,
handler : function() {
// var _select = grid.getSelectionModel().getSelected();
if (form2.form.isValid()) {
form2.form.submit( {
// url : 'updateEPSItem.action?itemVO.ID='+_select.get('itemVO.ID')+'',
success : function(from, action) {
Ext.Msg.alert('Edit Data Success', 'Edit Data Success!!');
// newFormWin2.hide();
// store.reload();
},
failure : function(form, action) {
Ext.Msg.alert('Edit Data Error', 'Edit Data Error!');
},
waitMsg : 'Saving data,please wait...'
});
} else {
Ext.Msg.alert('Information', 'please submit after fill all data!');
}
}
}, {
text : 'Cancel',
handler : function() {
// newFormWin2.hide();
}
}]
});
form2.form.load({
url:'findEPSItemByID.action',
waitMsg:'please warting!',
success:function(form,action){
Ext.Msg.alert('Success','Loading success!');
},
failure:function(form,action){
Ext.Msg.alert('Error','Loading Error!');
}
});
但是页面一直加载,错误提示为:length为空或不是对象,可是后台的itemVOList是有值的啊。
大家都是怎么加载form的啊
[解决办法]
var transferForm = new Ext.form.FormPanel({
region:'north',
labelWidth: 90,
buttonAlign: 'center',
labelAlign: 'right',
frame:true,
items:[{name:'aa'}, {name:'bb'}]
});
transferForm.render("form");
transferForm.getForm().load({
url :path+'/aaaaaa.action',
methed: 'post',
params: {processId:'<%=request.getParameter("processId")%>',taskId:'<%=request.getParameter("taskId")%>',fncSrvNo:'<%=request.getParameter("fncSrvNo")%>'},
waitMsg : '正在载入数据...',
success : function(transferForm,action) {
Ext.Msg.alert("提示",'加载成功');
return;
},
failure : function(transferForm,action) {
var o = Ext.decode(action.response.responseText);
Ext.Msg.alert("提示",o.msg);
}
});