Extjs在使用rowEditing的时候,会在每一列加上editor属性,表示当处于编辑状态时这一列的值是什么类型的,后突然发现在rowEditing处于编辑状态时每一列的宽度边框了,如果列数非常多的话会出现列向后推,知道最后一列被隐藏或是看不到,当然通过tan键是可以到最后的,但是处于编辑状态的列与上面的列名不相互对应了,出现了列不齐的状况,如下图:

未编辑前:

双击处于编辑状态:

很明显的看到每一列都不对应了,解决这个问题的办法就是在每一列的editor属性上面加上maxWidth这个配置,加上之后效果如下:

源码:

 var haomglGeimjGrid = Ext.create('Ext.grid.Panel', {
id: 'haomglGeimjGrid',
name: 'haomglGeimjGrid',
width: panelWidth,
height: 120,
store: haomglGeimjGrid_store,
header: false,
columnLines : true,
selModel: selModelGeimj,
autoScroll : true,
selType: 'cellmodel',
plugins: [rowEditingGeimj],
columns: [{
xtype: 'gridcolumn',
dataIndex: 'name',
width: 100,
align: 'center',
header:'<div style=" text-align: center; vertical-align: middle;">给煤机</div>',
text: 'String',
emptyCellText: '耗煤量(吨)',
editor: {
xtype: 'textfield',
maxWidth: 90,
width: 90,
readOnly: true,
value: '耗煤量(吨)',
emptyText: '耗煤量(吨)'
}
}, {
xtype: 'gridcolumn',
text: '#7号机组',
header:'<div style=" text-align: center; vertical-align: middle;">#7号机组</div>',
columns: [{
xtype: 'numbercolumn',
dataIndex: 'geimj_7_a',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">A</div>',
text: 'A',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_7_b',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">B</div>',
text: 'B',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_7_c',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">C</div>',
text: 'C',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_7_d',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">D</div>',
text: 'D',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_7_e',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">E</div>',
text: 'E',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_7_f',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">F</div>',
text: 'F',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}]
}, {
xtype: 'gridcolumn',
text: '#8号机组',
header:'<div style=" text-align: center; vertical-align: middle;">#8号机组</div>',
columns: [{
xtype: 'numbercolumn',
dataIndex: 'geimj_8_a',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">A</div>',
text: 'A',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_8_b',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">B</div>',
text: 'B',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_8_c',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">C</div>',
text: 'C',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_8_d',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">D</div>',
text: 'D',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_8_e',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">E</div>',
text: 'E',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}, {
xtype: 'numbercolumn',
dataIndex: 'geimj_8_f',
align: 'center',
width: 85,
header:'<div style=" text-align: center; vertical-align: middle;">F</div>',
text: 'F',
editor : {
xtype : 'numberfield',
maxWidth: 80,
width: 80,
allowBlank : true,
minValue : 0
}
}]
}, {
xtype: 'actioncolumn',
align: 'center',
width:30,
items: [{
cls : "x-btn-text-icon",
icon: '../images/extjs/application_edit.png',
tooltip: '编辑',
handler: function(haomgl_grid, rowIndex, colIndex) {
var date = Ext.getCmp('statdate').getValue();
var nowdate = new Date();
var year = nowdate.getFullYear();
var month = nowdate.getMonth();
var day = nowdate.getDate();
var currentdate = new Date(year, month, day);
if(date >= currentdate){
rowEditingGeimj.startEdit(rowIndex, 0);
}
}
}]
}]
});

Extjs之rowEditing编辑状态时列不对齐的更多相关文章

  1. jqgrid 让隐藏的列在编辑状态时出现且可编辑

    有时,我们需要隐藏一个列数据,但在启动编辑时又能够被编辑. 1.设置列为编辑:editable: true 2.设置 editrules属性值为: edithidden: true colModel: ...

  2. iOS tableview上textView在编辑状态时,tableview自动上移的功能

    在viewcognroller中,添加tableview时, tableview中cell上的textField如果吊起键盘时,tableview时可以自动上移,但是如果是textView吊起键盘,t ...

  3. DataGridView在Cell编辑状态响应回车键下的KeyPress/KeyDown/KeyUp事件

    我们知道由于DataGridView的单元格DataGridCell处于编辑的时候,当你按Enter键,那么DataGridView是不会激发KewPress/KeyDown/KeyUp这些事件的,因 ...

  4. DataGridView的DataGridViewComboBoxColumn列点击一次,自动处于编辑状态

    本文转载:http://www.cnblogs.com/Johnny_Z/archive/2012/02/12/2348235.html Winform中的DataGridView数据绑定控件有时会用 ...

  5. easyui 在编辑状态下,动态修改其他列值。

    首先是自定义了一个方法uodateColumn更新列值 /** *自定义的修改列值方法 */ $.extend($.fn.datagrid.methods, { updateColumn: funct ...

  6. 速成KeePass全局自动填表登录QQ与迅雷(包括中文输入法状态时用中文用户名一键登录)

    原文:http://bbs.kafan.cn/thread-1637531-1-1.html 使用目的:1 网页和本地客户端登录一站式解决2 通过KeePss修改密码和登录更方便,可以复制粘贴,省了输 ...

  7. jqgrid 批量启动所有行为可编辑状态

    有时,为操作方便,需要将jqgrid表格设置为一直处于编辑状态,用户只需要在对应的编辑区填写自己信息,不再频繁的去触发行编辑和保存. 参考代码如下: //$gridCase为传入jqgrid对象 fu ...

  8. 在DBGrid中可选中行而又可进入编辑状态

    如何在DBGrid中选中行,而又让它可以进入编辑状态? 也许你会问我这有什么用?呵呵,做数据库应用的兄弟们会深有感触,当用DBGrid显示的字段过多时,用户不得不拉动最下面的滚动条,去看最右边的东西, ...

  9. Devexpress WinForm GridControl实现单元格可编辑状态更改

    之前做项目的时候,需要实现这样的功能.在gridcontrol中,根据是否修改(checkbox)列的选中和未选中状态来联动另外一列的编辑状态.实现如下: private void gridView1 ...

随机推荐

  1. Single Number III——LeetCode

    Given an array of numbers nums, in which exactly two elements appear only once and all the other ele ...

  2. 自定义WCF的配置文件

    原文地址:http://www.cnblogs.com/shanyou/archive/2008/12/02/1346298.html WCF的承载既可以通过编码实现,也能够通过配置实现.而且使用配置 ...

  3. Dolls - 4160(简单二分图匹配)

    题意:有一些箱子,大箱子可以套小箱子,但是必须h>h,w>w,l>l,求出来最外面能剩下几个箱子无法被嵌套.   分析:思考每个箱子都只会被别的箱子套一次,所以构成一二分匹配模型,只 ...

  4. ORA-01078:failure in processing system parameters

    一.使用环境操作系统:rhel 6.5 x64数据库:Oracle 11.2.0.1.0数据库主目录:/u01/app/oracle/product/11.2.0/ 二.问题描述用sys用户登录sql ...

  5. angularJS 过滤器 表单验证

    过滤器1.filter的作用就是接收一个输入,通过某个规则进行处理,然后返回处理后的结果,主要用于数据的格式化.2.内置过滤器(1)Currency(货币)将一个数值格式化为货币格式,默认为$(2)D ...

  6. es6小技巧

    let myKey = 'variableKey'; let obj = { key1: 'One', key2: 'Two', [myKey]: 'Three' /* 棒呆! */ }; 给变量键加 ...

  7. vxworks获取系统时间编程

    #include<time.h> //头文件 unsigned int timeLen; struct timespec tp; struct tm timeBuffer; time_t ...

  8. HDU 2066-一个人的旅行(最短路Dijkstra)

    一个人的旅行 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Sub ...

  9. 如何写好一个UITableView

    本文是直播分享的简单文字整理,直播共分为上.下两部分. 第一部分: 优酷 :http://v.youku.com/v_show/id_XMTUzNzQzMDU0NA%3Cmark%3E.html Or ...

  10. Django初探--开发环境搭建(笔记)

    1. Django框架的安装 (1) 下载Django源码 Django-1.7.11.tar.gz,并解压,网址:https://www.djangoproject.com/download/ (2 ...