ExtJS 2.3列自定义渲染器组件

ExtJS 2.3列自定义渲染器组件,extjs,Extjs,我想根据列值将带有自定义背景色的小正方形附加到列中 我为列定义了渲染器函数,例如: this.addColorSqureToToTextColumn = function(value,meta,record,rowIndex,colIndex,store) { var color = record.get("color"); return value; // how to append a boxcomponent with the background color after the

我想根据列值将带有自定义背景色的小正方形附加到列中

我为列定义了渲染器函数,例如:

this.addColorSqureToToTextColumn = function(value,meta,record,rowIndex,colIndex,store) {
  var color = record.get("color");
  return value; // how to append a boxcomponent with the background color after the value?
}

我知道我可以更改整个列的meta css并设置背景颜色,但我希望在值旁边有一个小的彩色方块。

没有意识到您可以简单地返回html标记:

this.addColorSqureToToTextColumn = function(value,meta,record,rowIndex,colIndex,store) {
  var color = record.get("color");
  return value + "<div style='position: relative; left: 10px; top: 5px;display:inline-block;height:20px;width:20px;background-color:" + color + ";'></div>";
}
this.addColorSQureToToToToTextColumn=函数(值、元、记录、行索引、colIndex、存储){
var color=record.get(“color”);
返回值+“”;
}
返回附加到“我的值”的块20x20