[英]Ext JS set color for words of a string inside a grid cell
I am trying to set different colors for different words inside a string, and this string is inside a ExtJs grid cell. 我试图为字符串中的不同单词设置不同的颜色,并且此字符串位于ExtJs网格单元中。 For example, I have a string 'Red Blue Green'.
例如,我有一个字符串“ Red Blue Green”。 I need use three colors for these three words.
我需要为这三个词使用三种颜色。 This is not that hard in javascript by fontcolor, but I cannot figure out how to do it in Ext Js grid store.
在fontfont的javascript中,这并不难,但是我无法弄清楚如何在Ext Js网格存储中做到这一点。 Could anyone give some insight on how to do this?
谁能提供一些有关如何执行此操作的见解? Thanks.
谢谢。
you need a custom column renderer
: 您需要一个自定义列
renderer
:
renderer: function(value){
var words = value.split(' ');
return '<span style="color:#f00">'+words[0]+'</span><span style="color:#0f0">'+words[1]+'</span><span style="color:#00f">'+words[2]+'</span>';
}
if every value has three words. 如果每个值都有三个字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.