extjs Ext.form.FormPanel取值问题
addWindow:function(index){
var record=this.store.getAt(index).data;
var oldThis=this;
var url=this.contextUrl;
var temp;
var form = new Ext.form.FormPanel({ id : "form"
});
$.ajax({
url:url+"tableName",
async:false,
success: function(response, options){
console.log("sucess");
temp=eval(response);
},
failure: function(response, options){
console.log("faile");
},
scope: this
});
var flag=true;
for(var i in temp.rows){
if(temp.rows[i].COMMENTS){
var fd = new Ext.form.TextField({name:temp.rows[i].COLUMN_NAME,id:temp.rows[i].COLUMN_NAME,fieldLabel:temp.rows[i].COMMENTS});
form.items.add(form.items.getCount(), fd);
}
};
form.doLayout();
console.log(form)
var window = new Ext.Window({
title: '添加数据',
width: 500,
height:500,
minWidth: 300,
minHeight: 200,
layout: 'fit',
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: form,
buttons: [{
text: '确定',
formBind: true,
handler:function(){
form.getForm().submit({//表单为什么递交都是空的这是怎么回事
waitTitle:"请稍候",
waitMsg:"正在提交表单数据,请稍候",
method:"POST",
async : false,
url:url+"addData",
success : function(form, json) {
oldThis.loadFeed(url);
window.close();
},
failure : function(form, json) {
alert("fail")
}
});
window.close();
}
},{
text: '取消',
handler: function (){
window.close();
}
}]
});
}