您的位置:首页 > Web前端 > JavaScript

extjs动态插入一列

2015-06-12 10:36 507 查看
StdDayWordQuery:function(btn,event){
var form=Ext.getCmp('queryFormSDW');
var userNameORuserCode = form.getForm().getValues()['userNameORuserCode'];
var gradeCode = form.getForm().getValues()['gradeCode'];
var startDate = form.getForm().getValues()['startDate'];
var endDate = form.getForm().getValues()['endDate'];

var params="gradeCode="+gradeCode+'&';
params+="userNameORuserCode="+userNameORuserCode+'&';
params+="startDate="+startDate+'&';
params+="endDate="+endDate;

Ext.Ajax.request({
method : 'POST',
url:'getDailyWordNum.action?'+params,
async:false,
success:function(response) {
var ret=Ext.decode(response.responseText);
//                console.log(ret);
if(ret.success){
//eval("var res=" + response.responseText);
//var rows = res.rows;
var rows=Ext.decode(response.responseText).rows;
var cols = new Array();
var xx = new Array();
console.log(rows);
console.log(rows[0]);
for(var x in rows[0]){
//console.log(x);
cols.push(new Ext.grid.column.Column({
text: x,
dataIndex : x
}));
xx.push(x);
}
console.log(xx);
var store = new Ext.data.Store({
fields: xx,
data: rows
});
var grid = Ext.getCmp('StudentDayWordGrid');
grid.reconfigure(store,cols);
}
else{
Ext.Msg.alert("错误", ret.msg);
}
}
});
},
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: