extjs动态添加列
可以根据日期,动态的插入一列

controller层:
StdDayWordQuery:function(btn,event){
var form=Ext.getCmp('queryFormSDW');
paramsForDayWord=Ext.encode(form.getForm().getValues());
Ext.Ajax.request({
url:'getDailyWordNum.action',
headers: {
'Content-Type': 'application/json'
},
params :paramsForDayWord,
async:false,
success:function(response) {
var results=Ext.decode(response.responseText);
if(results.success){
var rows = results.rows;
var header = results.header;
var cols = new Array();
cols.push(new Ext.grid.RowNumberer({
xtype:'rownumberer',
text:'序号',
flex:1,
align:'center'
}));
for(var x in header){
cols.push(new Ext.grid.column.Column({
text: header[x],
dataIndex : header[x],
flex:1,
align:'center'
}));
}
var store = new Ext.data.Store({
fields: header,
data: rows
});
var grid = Ext.getCmp('StudentDayWordGrid');
grid.reconfigure(store,cols);
Ext.getCmp('StudentDayWordGrid').show();
}
else{
Ext.Msg.alert("错误", results.msg);
paramsForDayWord="";
Ext.getCmp('StudentDayWordGrid').hide();
}
}
});
},
view层:
Ext.define('ExtApp.view.StudentDayWord', {
extend : 'Ext.panel.Panel',
xtype : 'StudentDayWord',
overflowY:'auto',
fieldDefaults: {
labelAlign: 'left',
msgTarget: 'side'
},
layout: {
type:'vbox',
align:'stretch'
},
border:false,
items:[{
height:40,
border:false,
items:[{
xtype:'form',
height:40,
id:'queryFormSDW',
width:'100%',
items:[{
xtype:'container',
padding:5,
layout:{
type:'hbox'
},
items:[{
labelWidth:60,
width: 200,
labelAlign:'right',
xtype:'combo',
fieldLabel:'选择年级',
name:'gradeCode',
id : 'cobStdDayWordGradeCode',
store : 'Grade',
valueField : 'gradeCode',
displayField : 'gradeName',
editable : false,
emptyText : '请选年级',
queryMode : 'local'
},{
xtype : 'textfield',
labelSeparator:':',
labelWidth : 150,
width: 300,
labelAlign : 'right',
name:'userNameORuserCode',
fieldLabel : '输入学生ID或学生姓名'
},{
xtype:'datefield',
labelWidth :60,
width: 200,
fieldLabel:'起止日期:',
id:'startDate',
labelAlign : 'right',
name:'startDate',
format:'Y-m-d'
},{
xtype:'datefield',
labelWidth :20,
width: 160,
fieldLabel:' 至 ',
labelAlign : 'right',
id:'endDate',
labelSeparator:' ',
name:'endDate',
format:'Y-m-d'
},{
xtype : 'button',
width:80,
margin:'0 10 0 10',
id : 'btnStdDayWordQuery',
text : '查询'
},{
xtype : 'button',
width:80,
id : 'btnStdDayWordReset',
text : '重置'
},{
xtype : 'button',
width:80,
margin:'0 10 0 10',
id : 'btnStdDayWordToExcel',
text : '导出Excel'
}]
}]
}]
},{
xtype:'grid',
hidden:true,
columnLines:true,
cls:'custom-grid',
id : 'StudentDayWordGrid',
columns : []
}]
});
extjs动态添加列的更多相关文章
- asp.net gridview动态添加列,并获取其数据;
1,绑定数据前先动态添加列,见方法CreateGridColumn(只在第一次加载动态添加): 2,gvlist_RowDataBound为对应列添加控件: 前台代码: <%@ Page Lan ...
- GridView动态添加列之后,导致PostBack(回发)页面数据丢失问题解决
直入主题,首先声明,这个问题是无法解决的,特此在这说明 一.如何动态添加列,如下: 在页面重写OnInit事件,至于为什么要在这个事件写,根据页面的声明周期和经验可知(不用去别的地方找了,这个我找了之 ...
- [转]RDLC报表——动态添加列
本文转自:http://www.cnblogs.com/pszw/archive/2012/07/19/2599937.html 前言 最近接到一个需求:在给定的数据源中,某(些)列,可能需要单独统计 ...
- DataGridview动态添加列
1.获取数据源(select * from table名称) 2.动态绑定数据源 private void GetTableInfo(DataTable dt) { listBh = new List ...
- Wpf DataGrid动态添加列,行数据(二)
这是第二中方法,可直接绑定,我这里只是做出了一种思路,并不是最完美. 这里注意一下,因为我里面引用了MVVMLight,所以可能代码不是复制过去就能用了的. 样式也是,所以复制过去看不是我贴出来的界面 ...
- gridview动态添加列的问题
相信大家也和我一样遇到过这种问题,gridview在生成列的时候当列不确定怎么办?下面分享一下自己的解决方法. 举个列子说明一下. 普通列的添加比较简单. BoundField bf = new Bo ...
- GridView动态添加列并判断绑定数据DataTable的列类型控制展示内容
此篇随笔是2013年根据项目需求开发记录的,不一定符合大众口味,只需了解开发思路,毕竟解决方案多种多样. 下面简单说说需求点吧: (1)通过下拉列表可以选择一个DataSet(数据集),一个DataS ...
- C# DataGridView 动态添加列和行
https://blog.csdn.net/alisa525/article/details/7350471 dataGridView1.ReadOnly = true ; //禁用编辑功能 ...
- 记一次LayUI中Table动态添加列数据
这次在开发中遇到,有列数不固定的情况.废话不多说,先上图,在上代码. 下面上JS代码 function SearchData() { var dYear = $("#DYear") ...
随机推荐
- 2015年沈阳网赛 Jesus Is Here(DP中的计数问题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5459 题目描述:给定一个递推得来的字符串,问字符串中不同cff之间的距离之和, 递推规则: s1=c; ...
- java笔记之线程简述1
1:线程是依赖于进程而存在. 2:什么是进程? 通过任务管理器我们就看到了进程的存在. 而通过观察,我们发现只有运行的程序才会出现进程. 进程:就是正在运行的程序. 进程是系统进行资源分配和调 ...
- “Live Desktop” privacy statement
“Live Desktop” pays attention to your privacy protection. Sometimes we need some information to prov ...
- J20170524-hm
取りこぼし 意外地输给较自己实力弱的对手,爆出冷门,败给手下败将 振り分け 分配,整理 スキーマ 图解.模式.图式
- maven配置文件注意事项
1:安装完成后在C:\Users\Administrator\.m2有一个文件settings.xml需要修改一下配置 2:设置maven从网上下载的jar包.(时间长会很大).我设置它保存我的电脑位 ...
- FOJ2252:Yu-Gi-Oh!
传送门 题意 略 分析 枚举合成ab的数量,在此基础上合成bc和ac,复杂度\(O(n)\) trick 代码 #include<cstdio> #include<algorithm ...
- bzoj 4826: [Hnoi2017]影魔【单调栈+树状数组+扫描线】
参考:https://www.cnblogs.com/lcf-2000/p/6789680.html 这是一个相对码量少的做法,用到了区间修改区间查询的树状数组,详见:www.cnblogs.com/ ...
- Spring Boot:关于“No converter found for return value of type: class xxx”的解决方法
首先在对应的controller中的@RestController中返回json对象的操作 public class HelloController { @RequestMapping("/ ...
- Elasticsearch的功能、使用场景以及特点
1.Elasticsearch的功能,干什么的 2.Elasticsearch的适用场景,能在什么地方发挥作用 3.Elasticsearch的特点,跟其他类似的东西不同的地方在哪里 1.Elasti ...
- php 文件锁flock解决并发
方案一:使用文件锁排它锁 flock函数用于获取文件的锁,这个锁同时只能被一个线程获取到,其它没有获取到锁的线程要么阻塞,要么获取失败 在获取到锁的时候,先查询,如果查询成功则进行操作,然后释放锁 f ...