首页 > 解决方案 > extjs的templatecolumn隐藏时不计算数据,能不能让它计算数据?

问题描述

我们使用 extjs 的 templatecolumn 来计算数据并在别处显示该信息。网格有几列可编辑,编辑后,模板列中的计算发生。但是当模板列被隐藏时,数据不会随着网格值的变化而变化。

模板列的列配置

{
    "xtype": "templatecolumn",
    "text": "Cases",
    "resizable": true,
    "draggable": false,
    "hidden": true,
    "hideMode": 'offsets', /** tried all hideMode - 'visibility, display and offsets' for resolving issue but not helped **/
    "width": 80,
    "align": "right",
    "cls": "clsPPFHeaderCols",
    "tdCls": "clsCells",
    "tpl": [
        "<tpl for='.'>",
        "{[getPlannerWorkAreaManager().getPerCases(undefined, values)]}",
        "</tpl>"
    ]
}

并且函数 getPerCases 有一些计算也涉及网格中的其他数据。

标签: extjs

解决方案


很高兴它有帮助:在模型上创建一个“转换的”字段,而不是使用 templatecolumn :

  { 
     name:    'cases', 
     convert: function (value) { 
                  return getPlannerWorkAreaManager().getPerCases(value); 
              } 
  }

推荐阅读