【问题标题】:Dojo datgrid cell font colourDojo datagrid 单元格字体颜色
【发布时间】:2011-11-10 15:06:40
【问题描述】:

如何在 dojo 数据网格中为单元格添加字体颜色?我需要动态更改颜色(取决于它获得的值)。我不想使用从 formatter 方法返回的 html 标签。

例如, 'number' 小于 0 为红色,大于 0 为蓝色。

在布局中,

number{
 formatter : format
}

方法,

var format(value){
  if(value<0){
     // what should to returned to change font color without html tag?
  }else if(value>0){
    // what should to returned to change font color without html tag?
  }
}

【问题讨论】:

  • 不明白,要不要用html标签?
  • 非常抱歉造成混淆

标签: datagrid dojo


【解决方案1】:

你可以试试

dojo.style(node, style, value);

如果你知道节点。之后,您可能需要渲染网格。 这应该与在格式化程序中使用 html 标记具有相同的效果。这在美学上可能看起来很丑,但很有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-16
    • 2014-06-16
    • 2012-08-02
    • 2021-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    相关资源
    最近更新 更多