我写的一小段代码,生成一个Grid后,把第2行变成红色,结果没有效果,请您指正,多谢!
Ext.onReady(function(){
var cm = new Ext.grid.ColumnModel([
{header: 'name', dataIndex: 'name'},
{header: 'sex', dataInex: 'sex'},
]);
var PersonRecord = Ext.data.Record.create([
{name: 'name', type: 'string'},
{name: 'sex', type: 'int'},
{name: 'color', type: 'string'}
]);
var data = [
['boy', 0, '#FBF8BF'],
['girl', 1, '#99CC66'],
['man', 0, '#F5C0C0'],
['woman', 1, '#FF0000']
];
var store = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({}, PersonRecord)
});
store.load();
var grid = new Ext.grid.GridPanel({
store: store,
cm: cm,
autoHeight: true,
renderTo: 'grid',
});
我想把第2行设置为红色,结果运行后没有任何效果,请您指教!多谢!
grid.getView().getRow(1).style.backgroundColor='#FF0000';
grid.getView().refresh(true);
});