extjs - 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 有一些计算也涉及网格中的其他数据。
解决方案
很高兴它有帮助:在模型上创建一个“转换的”字段,而不是使用 templatecolumn :
{
name: 'cases',
convert: function (value) {
return getPlannerWorkAreaManager().getPerCases(value);
}
}
推荐阅读
- excel - VBA 使用单元格引用隐藏列和行
- apache-kafka - Kafka 连接基于大小的翻转和基于时间的单个分区翻转
- minecraft - Minecraft 执行命令根本不起作用
- javascript - 如何通过地图投影调整将 GeoTIFF 图像导入 d3-geo 地图?
- css - 为什么多个媒体查询不起作用?
- javascript - 有没有办法使用 javascript 仅验证表单中启用的字段?
- powershell - 从 powershell 管理设备
- php - 在PHP中连接数组中的字符串忽略空格
- postgresql - 下班后 Postgres CPU 使用率高
- sql - 如何计算多行和同一列中的每个值?