css 在ext-js中为特定列表格中只读的textfield添加背景颜色

toiithl6  于 2023-03-24  发布在  其他
关注(0)|答案(1)|浏览(140)

我正在尝试为网格表中的2列添加背景色。我该如何做?
我知道ExtJS 4 - How to add background colors to columns of a grid?,但我正在寻找一个特定的属性,我可以使用,而不是一个函数。有没有任何属性,我可以配置添加背景颜色在这里代替?
请在下面找到我的代码-

var ALIASGRID = new Ext.grid.EditorGridPanel({
                store : ALIASGRIDStore,
                stripeRows : true,
                hideHeaders : true,
                id : "ALIASGRID",
                region : 'center',
                clicksToEdit : 1,
                autoHeight : true,
                viewConfig : {
                    markDirty : false
                },
                columnLines : true,
                columns : [ {
                    id : 'Test',
                    header : 'Test',
                    dataIndex : 'Test',
                    width : 30,
                    editor: {
                    xtype: 'textfield',
                    triggers: {
                        search: {
                            cls: 'x-fa fa-search',
                            handler: function (field, trigger, eOpts) {}
                                }
                            }
                        },
                    renderer : renderTooltipAndId
                }],
                listeners : {
                    beforeedit : function(grid) {
                        if (!attributeMgrEnabled) {
                            return false;
                        }
                        // console.log(grid);
                    }
                }
            });
            
var ALIASFOOTER = new Ext.grid.EditorGridPanel({
                enableHdMenu : false,
                id : 'ALIASFOOTER',
                height : 19,
                store : ALIASFOOTERStore,
                columns : [ {
                    id : 'Test',
                    header : 'Testing.',
                    resizable : false,
                    width : 30
                }]});           
                
                
// Table that shows empty rows & a footer
            var layoutTable1 = new Ext.Panel({
                width : 470,
                items : [ ALIASGRID, ALIASFOOTER ],
                renderTo : 'AliasTable'
            });

我尝试使用bodyStyle: 'background-color: #ff0000';属性,但它不起作用。

lx0bsm1f

lx0bsm1f1#

您可以在列上使用tdCls config来定义相应列的各个单元格上的类。
https://docs.sencha.com/extjs/7.6.0/classic/Ext.grid.column.Column.html#cfg-tdCls
小提琴:https://fiddle.sencha.com/#fiddle/3n58&view/editor

相关问题