extjs动态插入一列
1 StdDayWordQuery:function(btn,event){ 2 var form=Ext.getCmp('queryFormSDW'); 3 var userNameORuserCode = form.getForm().getValues()['userNameORuserCode']; 4 var gradeCode = form.getForm().getValues()['gradeCode']; 5 var startDate = form.getForm().getValues()['startDate']; 6 var endDate = form.getForm().getValues()['endDate']; 7 8 var params="gradeCode="+gradeCode+'&'; 9 params+="userNameORuserCode="+userNameORuserCode+'&'; 10 params+="startDate="+startDate+'&'; 11 params+="endDate="+endDate; 12 13 Ext.Ajax.request({ 14 method : 'POST', 15 url:'getDailyWordNum.action?'+params, 16 async:false, 17 success:function(response) { 18 var ret=Ext.decode(response.responseText); 19 // console.log(ret); 20 if(ret.success){ 21 //eval("var res=" + response.responseText); 22 //var rows = res.rows; 23 var rows=Ext.decode(response.responseText).rows; 24 var cols = new Array(); 25 var xx = new Array(); 26 console.log(rows); 27 console.log(rows[0]); 28 for(var x in rows[0]){ 29 //console.log(x); 30 cols.push(new Ext.grid.column.Column({ 31 text: x, 32 dataIndex : x 33 })); 34 xx.push(x); 35 } 36 console.log(xx); 37 var store = new Ext.data.Store({ 38 fields: xx, 39 data: rows 40 }); 41 var grid = Ext.getCmp('StudentDayWordGrid'); 42 grid.reconfigure(store,cols); 43 } 44 else{ 45 Ext.Msg.alert("错误", ret.msg); 46 } 47 } 48 }); 49 },