如何根据严重性条件更改datagrid中的行颜色?我是这个EXTJS主题的新手。我习惯读者阅读,存储和写作来写数据。在将所有数据提取到网格后,如何根据严重性条件更改datagrid中的行颜色?你可以用代码解释我吗?
How can I change the row colour in datagrid based upon the severity condition? I'm new to this EXTJS topic. I used to reader to read, store to store and writer to write the data. After fetching all the data into the grid, how can i change the row colour in datagrid based upon the severity condition? Can you explain me too bit with code working?
推荐答案你可以使用 GridView 类( Ext.grid.GridView )来操作网格的用户界面。您还可以使用 GridPanel 的 viewConfig 属性。这里有一个例子:
you can use the GridView class (Ext.grid.GridView) to manipulate the user interface of the grid. You can also the viewConfig property of the GridPanel. Here is an example:
viewConfig: { //Return CSS class to apply to rows depending upon data values getRowClass: function(record, index) { var c = record.get('change'); if (c < 0) { return 'price-fall'; } else if (c > 0) { return 'price-rise'; } } }ps: ExtJS API文档本身采取的示例
ps: Example taken from ExtJS API documentations itself
价格下降和价格上涨是相应设置背景颜色的CSS。例如:
The price-fall and price-rise are CSS that have background colors set accordingly. eg:
.price-fall { background-color: #color; } .price-rise { background-color: #color; }更多推荐
如何根据严重性更改datagrid中的行颜色?
发布评论