Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ExtJS 5网格编辑_Extjs_Grid - Fatal编程技术网

ExtJS 5网格编辑

ExtJS 5网格编辑,extjs,grid,Extjs,Grid,我试图准备一个只有两列的简单网格用于编辑(右边的最后两列:number和checkbox)。通过CellEditingplugin进行编辑 网格如下所示: 网格定义的标题为: { xtype: 'gridpanel', store: 'TimeStore', border: true, width: 800, cls: 'm-grid', margin: '10 0 0 0', selType:

我试图准备一个只有两列的简单网格用于编辑(右边的最后两列:
number
checkbox
)。通过
CellEditing
plugin进行编辑

网格如下所示:

网格定义的标题为:

{
       xtype: 'gridpanel',
       store: 'TimeStore',
       border: true,
       width: 800,
       cls: 'm-grid',
       margin: '10 0 0 0',
       selType: 'cellmodel',
       plugins: [
           Ext.create('Ext.grid.plugin.CellEditing', {
               clicksToEdit: 1,
               ptype: 'cellediting',
               listeners: {
                   'edit': function(edytor, data, event) {
                       ...
                       data.grid.view.refresh();
                       data.grid.getStore().commitChanges();
                   }
               }
           })
       ],
       features: [{
           ftype: 'summary'
       }],
       columns: [{..
       }]
   }
CSS定义:

.m-grid .x-grid-cell-selected{
    background-color: transparent !important;
}
两列定义如下:

{
    align: 'center',
    width: 80,
    dataIndex: 'F_NUM',
    editor: {
        xtype: 'textfield',
        allowBlank: false,
        maskRe: /[0-9,]/
    },
    renderer: function(value, meta) {
        meta.style = "background-color:lightgray;";
        return value;
    }
}, {
    xtype: 'checkcolumn',
    align: 'center',
    width: 80,
    dataIndex: 'F_CHCK',
    editor: {
        xtype: 'checkboxfield'
    }
}
这个数字字段按预期正常工作,但我不知道最后一列出了什么问题。此复选框列的版本无法正常工作(当我选中它并转到其他位置时,选中的位置变为未选中),此外,我无法设置与我为带有数字的列设置的相同的背景(此浅灰色背景色)

我尝试使用样式:

renderer: function(value, meta) {
    meta.style = "background-color:lightgray;";
}
但结果如下:


我找不到这段代码有什么问题,你能帮忙吗?

checkcolumn
是一种特殊的列类型,在没有编辑器的情况下已经可以编辑。清除但我选中了它,当我从列定义中删除“editor”属性时,情况是一样的,可以关闭复选框,但不能打开,过一段时间后不能更改背景颜色-问题在于值(布尔值和int值),在我的例子中,模型中的这个值是int类型的,所以我添加了转换函数:“convert:function(v,record){return typeof v=='boolean'?(v==true?1:0):v;}}“现在我可以打开/关闭此字段,但背景颜色仍然很难理解