EXTjs grid双层表头的实现 (源代码和示例).docx_第1页
EXTjs grid双层表头的实现 (源代码和示例).docx_第2页
EXTjs grid双层表头的实现 (源代码和示例).docx_第3页
EXTjs grid双层表头的实现 (源代码和示例).docx_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

源代码:加载到页面中的js文件GridDoubleHeader.js/* author * since * description 双层表头* param* mtext 表头名 * param* mcol 向后跨越子表头个数* param* mwidth 上至下第一层表头的宽度,即父表头的宽度 * class MyGridView* extends Ext.grid.GridView*/MyGridView = Ext.extend(Ext.grid.GridView, renderHeaders : function() var cm = this.cm, ts = this.templates; var ct = ts.hcell, ct2 = ts.mhcell; var cb = , sb = , p = , mcb = ; for (var i = 0, len = cm.getColumnCount(); i len; i+) p.id = cm.getColumnId(i); p.value = cm.getColumnHeader(i) | ; p.style = this.getColumnStyle(i, true); if (cm.configi.align = right) p.istyle = padding-right:16px; cbcb.length = ct.apply(p); if (cm.configi.mtext) mcbmcb.length = ct2.apply( value : cm.configi.mtext, mcols : cm.configi.mcol, mwidth : cm.configi.mwidth ); var s = ts.header.apply( cells : cb.join(), tstyle : width: + this.getTotalWidth() + ;, mergecells : mcb.join() ); return s; );viewConfig = templates : header : new Ext.Template( , mergecells + cells , ), mhcell : new Ext.Template( value, ) ;/* author * since * description 双层表头* param* mtext 表头名 * param* mcol 向后跨越子表头个数* param* mwidth 上至下第一层表头的宽度,即父表头的宽度 * class MyGridView* extends Ext.grid.GridView*/MyGridView = Ext.extend(Ext.grid.GridView, renderHeaders : function() var cm = this.cm, ts = this.templates; var ct = ts.hcell, ct2 = ts.mhcell; var cb = , sb = , p = , mcb = ; for (var i = 0, len = cm.getColumnCount(); i len; i+) p.id = cm.getColumnId(i); p.value = cm.getColumnHeader(i) | ; p.style = this.getColumnStyle(i, true); if (cm.configi.align = right) p.istyle = padding-right:16px; cbcb.length = ct.apply(p); if (cm.configi.mtext) mcbmcb.length = ct2.apply( value : cm.configi.mtext, mcols : cm.configi.mcol, mwidth : cm.configi.mwidth ); var s = ts.header.apply( cells : cb.join(), tstyle : width: + this.getTotalWidth() + ;, mergecells : mcb.join() ); return s; );viewConfig = templates : header : new Ext.Template( , mergecells + cells , ), mhcell : new Ext.Template( value, ) ;修改grid的cm配置var ldrk_cm = new Ext.grid.ColumnModel(new Ext.grid.RowNumberer(mtext : ,/ 给父表头取的名字mcol : 1,/ 包含了几列mwidth : 20,/ 子表头宽度width : 20,/ 被包含子表头的宽度,最好填写一下header : No.), mtext : 本地住址或,mcol : 1,mwidth : 190,width : 200,header : 管理单位,dataIndex : address, mtext : ,mcol : 1,mwidth : 80,width : 80,header : 姓名,sortable : true,dataIndex : name, mtext : 性,mcol : 1,mwidth : 30,width : 30,header : 别,sortable : true,dataIndex : sex, mtext : ,mcol : 1,mwidth : 80,width : 80,header : 出生年月,dataIndex : birthday, mtext : ,mcol : 1,mwidth : 80,width : 90,header : 结婚年月,dataIndex : marryDate, mtext : ,mcol : 1,mwidth : 100,width : 110,header : 流动方向,dataIndex : moveAspect, mtext : 流入人口填户籍地名流出人口填流向地名,mcol : 1,mwidth : 200,width : 200,header : 流入(出)地名,dataIndex : placename, mtext : 流入(出),mcol : 1,mwidth : 80,width : 80,header : 年月,dataIndex : moveDate, mtext : 离开或返回,mcol : 1,mwidth : 80,width : 80,header : 年月,dataIndex : comeDate, mtext : 流入(出)初期子女,mcol : 2,mwidth : 100,width : 50,header : 男,dataIndex : man, width : 50,header : 女,dataIndex : woman, mtext : 流入(出)初期避孕情况,mcol : 2,mwidth : 160,width : 80,header : 采取措施名称,dataIndex : measureName, width : 80,header : 起始年月,dataIndex : startDate, mtext : 流动人口婚育证明发验情况,mcol : 4,mwidth : 320,width : 80,header : 发证年月,dataIndex : certificateDate, width : 80,header : 查验年月,dataIndex : checkDate, width : 80,header : 查验结果,dataIndex : checkResult, width : 80,header : 证件编号,dataIndex : certificateNo);var ldrk_cm = new Ext.grid.ColumnModel(new Ext.grid.RowNumberer(mtext : ,/ 给父表头取的名字mcol : 1,/ 包含了几列mwidth : 20,/ 子表头宽度width : 20,/ 被包含子表头的宽度,最好填写一下header : No.), mtext : 本地住址或,mcol : 1,mwidth : 190,width : 200,header : 管理单位,dataIndex : address, mtext : ,mcol : 1,mwidth : 80,width : 80,header : 姓名,sortable : true,dataIndex : name, mtext : 性,mcol : 1,mwidth : 30,width : 30,header : 别,sortable : true,dataIndex : sex, mtext : ,mcol : 1,mwidth : 80,width : 80,header : 出生年月,dataIndex : birthday, mtext : ,mcol : 1,mwidth : 80,width : 90,header : 结婚年月,dataIndex : marryDate, mtext : ,mcol : 1,mwidth : 100,width : 110,header : 流动方向,dataIndex : moveAspect, mtext : 流入人口填户籍地名流出人口填流向地名,mcol : 1,mwidth : 200,width : 200,header : 流入(出)地名,dataIndex : placename, mtext : 流入(出),mcol : 1,mwidth : 80,width : 80,header : 年月,dataIndex : moveDate, mtext : 离开或返回,mcol : 1,mwidth : 80,width : 80,header : 年月,dataIndex : comeDate, mtext : 流入(出)初期子女,mcol : 2,mwidth : 100,width : 50,header : 男,dataIndex : man, width : 50,header : 女,dataIndex : woman, mtext : 流入(出)初期避孕情况,mcol : 2,mwidth : 160,width : 80,header : 采取措施名称,dataIndex : measureName, width : 80,header : 起始年月,dataIndex : startDate, mtext : 流动人口婚育证明发验情况,mcol : 4,mwidth : 320,width : 80,header : 发证年月,dataIndex : certifi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论