You can insert a column dynamically based on the date.
Controller layer:
1Stddaywordquery:function(btn,event) {2 varFORM=EXT.GETCMP (' Queryformsdw ');3paramsfordayword=Ext.encode (Form.getform (). GetValues ()); 4 Ext.Ajax.request ({5URL: ' Getdailywordnum.action ',6 headers: {7' Content-type ': ' Application/json '8 }, 9 params:p Aramsfordayword,TenAsyncfalse, OneSuccessfunction(response) { A varresults=Ext.decode (response.responsetext); - if(results.success) { - varrows =results.rows; the varHeader =Results.header; - varcols =NewArray (); -Cols.push (NewExt.grid.RowNumberer ({ -Xtype: ' Rownumberer ', +Text: ' Serial number ', -Flex:1, +Align: ' center ' A })); at for(varXinchheader) { -Cols.push (NewExt.grid.column.Column ({ - Text:header[x], - Dataindex:header[x], -Flex:1, -Align: ' center ' in })); - } to varstore =NewExt.data.Store ({ + Fields:header, - data:rows the }); * varGrid = ext.getcmp (' Studentdaywordgrid '); $ grid.reconfigure (store,cols);Panax NotoginsengEXT.GETCMP (' Studentdaywordgrid '). Show (); - } the Else{ +Ext.Msg.alert ("Error", results.msg); AParamsfordayword= ""; theEXT.GETCMP (' Studentdaywordgrid '). Hide (); + } - } $ }); $},
View Layer:
1Ext.define (' ExtApp.view.StudentDayWord ', {2Extend: ' Ext.panel.Panel ',3Xtype: ' Studentdayword ',4Overflowy: ' Auto ',5 fielddefaults: {6LabelAlign: ' Left ',7Msgtarget: ' Side '8 },9 layout: {TenType: ' VBox ', OneAlign: ' stretch ' A }, -Borderfalse, - items:[{ theHeight:40, -Borderfalse, - items:[{ -Xtype: ' Form ', +Height:40, -ID: ' QUERYFORMSDW ', +Width: ' 100% ', A items:[{ atXtype: ' Container ', -Padding:5, - layout:{ -Type: ' Hbox ' - }, - items:[{ inLabelwidth:60, -width:200, toLabelAlign: ' Right ', +Xtype: ' Combo ', -Fieldlabel: ' Select Grade ', theName: ' Gradecode ', *ID: ' Cobstddaywordgradecode ', $Store: ' Grade ', Panax NotoginsengValuefield: ' Gradecode ', -Displayfield: ' Gradename ', theEditable:false, +Emptytext: ' Please choose Grade ', AQuerymode: ' Local ' the },{ +Xtype: ' TextField ', -Labelseparator: ': ', $labelwidth:150, $width:300, -LabelAlign: ' Right ', -Name: ' Usernameorusercode ', theFieldlabel: ' Enter student ID or student name ' - },{WuyiXtype: ' Datefield ', theLabelwidth:60, -width:200, WuFieldlabel: ' Start date: ', -ID: ' StartDate ', AboutLabelAlign: ' Right ', $Name: ' StartDate ', -Format: ' y-m-d ' - },{ -Xtype: ' Datefield ', ALabelwidth:20, +width:160, theFieldlabel: ' To ', -LabelAlign: ' Right ', $ID: ' EndDate ', theLabelseparator: ", theName: ' EndDate ', theFormat: ' y-m-d ' the },{ -Xtype: ' button ', inWidth:80, theMargin: ' 0 10 0 10 ', theID: ' Btnstddaywordquery ', AboutText: ' Query ' the },{ theXtype: ' button ', theWidth:80, +ID: ' Btnstddaywordreset ', -Text: ' Reset ' the },{BayiXtype: ' button ', theWidth:80, theMargin: ' 0 10 0 10 ', -ID: ' Btnstddaywordtoexcel ', -Text: ' Export Excel ' the }] the }] the }] the },{ -Xtype: ' Grid ', theHiddentrue, theColumnlines:true, theCLS: ' Custom-grid ',94ID: ' Studentdaywordgrid ', the columns: [] the }] the });98
ExtJS Adding columns dynamically