我找到了一些关于如何将css应用于grid的答案,但在我的情况下,它们都没有帮助我。
以下是我查看的链接:
- http://www.sencha.com/forum/showthread.php?109751-Add-color-to-column-property-grid
- 如何将背景颜色(或自定义 css 类)应用于网格中的列 - ExtJs 4?
- 如何根据严重性更改数据网格中的行颜色?
从Sencha看这个简单的例子:
Ext.create('Ext.grid.property.Grid', {
title: 'Properties Grid',
width: 300,
renderTo: Ext.getBody(),
source: {
"(name)": "My Object",
"Created": Ext.Date.parse('10/15/2006', 'm/d/Y'),
"Available": false,
"Version": 0.01,
"Description": "A test object"
}
});
我正在尝试更改“名称”列的背景颜色和一些文本格式。如何?
我知道很想进入该列以更改其大小,但 css 无法正常工作:
listeners : {
beforerender : function() {
var cols = this.getView().getHeaderCt().getGridColumns();
cols[0].setText("Property");
cols[0].setWidth(150);
}
}