利用的是Column的render 先看效果图: 代码如下: 复制代码 代码如下: <BR>.x-grid-cell.user-online <BR>{ <BR>background-color: #9fc; <BR>} <BR>.x-grid-cell.user-offline <BR>{ <BR>background-color: blue; <BR>} <BR> <BR>Ext.onReady(function () { <BR>Ext.widget('grid', { <BR>title: 'Users', <BR>store: { <BR>fields: ['name', 'email', 'online'], <BR>data: [ <BR>{ 'name': '王俊伟', 'email': 'wangjunwei1@163.com', 'online': true }, <BR>{ 'name': '王俊伟1', 'email': 'wangjunwei2@163.com', 'online': false }, <BR>{ 'name': '王俊伟2', 'email': 'wangjunwei3@163.com', 'online': false }, <BR>{ 'name': '王俊伟3', 'email': 'wangjunwei4@163.com', 'online': true } <BR>] <BR>}, <BR>columns: [ <BR>{ <BR>header: 'Name', <BR>dataIndex: 'name', <BR>renderer: function (value, meta, record) { <BR>meta.tdCls = record.get("online") ? 'user-online' : 'user-offline'; <BR>return value; <BR>} <BR>}, <BR>{ header: 'Email', dataIndex: 'email', flex: 1 }, <BR>{ header: 'Online', dataIndex: 'online' } <BR>], <BR>width: 400, <BR>renderTo: Ext.getBody() <BR>}); <br><br>}); <BR>