In ExtJS, how to add a custom CSS class to data grid rows?

前端 未结 5 1994
终归单人心
终归单人心 2020-12-20 16:20

How do I add custom CSS classes to rows in a data grid (Ext.grid.Panel)?

I\'m using ExtJS 4.0.

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-20 17:08

    If you want to change the class after the data has loaded, you can do it like this:

    myGridPanel.getView().removeRowCls(rowIndex,"old class");
    myGridPanel.getView().addRowCls(rowIndex,"new class");
    

    Here, rowIndex is the selected row, which you can get in some event functions(like "select"). By using this, you can change CSS of the row after clicking it.

提交回复
热议问题