【问题标题】:EXTJS color a cell when Ext.property.Grid filled with content当 Ext.property.Grid 填充内容时,EXTJS 为单元格着色
【发布时间】:2015-08-25 06:36:56
【问题描述】:

我在 ExtJS 中有一个 propertyGrid。当我用内容填充单元格文本时,我想为它着色。 初始化方法:

initGrid : function(propertyValues){
    this.model = Ext.decode(propertyValues);
    this.flexColumnGrid.setSource({});
    for(var i in this.model){
      //...
        var value = (this.model[i].value ? this.model[i].value : this.model[i].defVal);
        this.flexColumnGrid.setProperty(this.model[i].key, value, true);
    }

defVal 是属性的默认值。我使用它,当 value 为空并且属性有 defVal 时。 我有一个值验证方法,但我只在属性更改时使用它。这是事后编辑事件。

edit : function(ed,e) {
   //validate values
}

我可以用这种方法为单元格的文本着色

Ext.get(e.row.getElementsByTagName('td')[e.colIdx]).addCls('x-grid-wrong-value'); 

地点:

.x-grid-wrong-value{color:red} //the css

但我想在网格被内容填充时验证值。我该怎么做?

【问题讨论】:

    标签: javascript extjs colors


    【解决方案1】:

    一般来说你应该使用getRowClass这是一个例子:

    How to change background in row or cell

    这是一个例子:Fiddle for changing background

    【讨论】:

      猜你喜欢
      • 2014-10-22
      • 1970-01-01
      • 2013-04-09
      • 2017-02-25
      • 1970-01-01
      • 1970-01-01
      • 2014-09-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多