如何根据另一个单元格中的值格式化 ExtJS 树网格单元格
我正在尝试根据同一行中另一个单元格中的值来格式化一个 ExtJS 树形网格单元格。下面是我目前如何编码的概述。然而,这目前不起作用,所以我将不胜感激任何建议。谢谢!
function fn(v, values){
if (values.alarm == 1) {
return '<span style="color: red;">' + v + '</span>';
}
return v;
}
//new treegrid
columns:[{
header: 'H1',
width: 60,
dataIndex: 'duration1',
align: 'center',
tpl: new Ext.XTemplate(
'{duration1:this.doFormat}',
{doFormat: fn()}
)
}, {
header: 'A1',
width: 60,
dataIndex: 'alarm1',
align: 'center'
}]
I am trying to format one ExtJS treegrid cell based on the value in another cell in the same row. Below is an overview of how I currently have it coded. However, this is not currently working so I would appreciate any suggestions.Thanks!
function fn(v, values){
if (values.alarm == 1) {
return '<span style="color: red;">' + v + '</span>';
}
return v;
}
//new treegrid
columns:[{
header: 'H1',
width: 60,
dataIndex: 'duration1',
align: 'center',
tpl: new Ext.XTemplate(
'{duration1:this.doFormat}',
{doFormat: fn()}
)
}, {
header: 'A1',
width: 60,
dataIndex: 'alarm1',
align: 'center'
}]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
以下是我开发的解决方案,以便在其他人遇到相同问题时获得所需的内容。
Below is the solution I developed to get what I needed in case anyone else has the same issue.