-1

当我单击下面的网格单元格时,我想将类添加到行中,
我尝试了三个选项但不起作用。如何使它工作谢谢

listeners: {
        ,'cellclick': function (grid, td, cellIndex, record, tr, rowIndex, e, eOpts ) {
            // addclass to row
            Ext.fly(grid.getView().getRow(rowIndex)).addClass('bluerow'); // not working
            grid.getView().addRowCls(rowIndex, 'bluerow'); // not working
            Ext.get(e.target).addClass('bluerow'); // not working
        }
}
4

2 回答 2

2

cellclick 中的网格参数已经是一个视图。请看一下cellclick 您可以直接将 css 添加为:

grid.addRowCls(rowIndex, 'bluerow');

这是小提琴

于 2013-07-04T04:49:43.047 回答
1

试试下面的代码片段:

grid.getView().addRowCls(rowIndex,'bluerow'); 
grid.getView().removeRowCls(rowIndex,'bluerow');
于 2017-01-25T06:42:10.623 回答