如何根据严重性更改datagrid中的行颜色?

编程入门 行业动态 更新时间:2024-10-28 05:24:16
本文介绍了如何根据严重性更改datagrid中的行颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何根据严重性条件更改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中的行颜色?

本文发布于:2023-11-11 10:09:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578126.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:严重性   颜色   datagrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!