而不是使用getRow
,您可以使用您在此处看到tdCls
的属性,或者您可以定义一个自定义列:Ext.grid.column.Column
Ext.define('Ext.ux.grid.StyleColumn', {
extend: 'Ext.grid.column.Column',
alias: 'widget.stylecolumn',
/* author: Alexander Berg, Hungary */
defaultRenderer: function(value, metadata, record, rowIndex, colIndex, store, view) {
var column = view.getGridColumns()[colIndex];
//we can use different classes in each cell
if (record.data.tdCls) {
metadata.tdCls = record.data.tdCls;
//we can use different classes in each column
} else if (column.tdCls) {
metadata.tdCls = record.data.tdCls;
//we can use different classes in each grid (you can define it in viewConfig)
} else if (view.rowCls) {
metadata.tdCls = view.rowCls;
//we can add a default class
} else {
metadata.tdCls = 'mydefault';
}
return value;
}
});