如何在 Extjs6 中访问网格的 widgetcolumn 内的其他记录字段?
How to access other record fields inside grid's widgetcolumn in Extjs6?
我有一个带有进度条小部件列的网格:
{
xtype : 'widgetcolumn',
dataIndex: 'progress',
widget: {
xtype: 'progressbarwidget',
textTpl: [
'{percent:number("0")}% done'
]
}
}
如何将 textTpl
更改为类似 {record.data.field1} out of {record.data.field2}
的内容,似乎只能访问当前列值。
见http://examples.sencha.com/extjs/6.0.1/examples/kitchensink/#widget-grid
如果您查看 progressbarwidget
代码,您的恐惧是有根据的。
updateValue: function(value, oldValue) {
...
if (textTpl) {
me.setText(textTpl.apply({
value: value,
percent: Math.round(value * 100)
}));
}
您必须扩展 class,覆盖 updateValue
函数,并使用如下内容:
me.setText(textTpl.apply({
value: value,
percent: Math.round(value * 100),
record: me.$widgetRecord
}));
好了。
我有一个带有进度条小部件列的网格:
{
xtype : 'widgetcolumn',
dataIndex: 'progress',
widget: {
xtype: 'progressbarwidget',
textTpl: [
'{percent:number("0")}% done'
]
}
}
如何将 textTpl
更改为类似 {record.data.field1} out of {record.data.field2}
的内容,似乎只能访问当前列值。
见http://examples.sencha.com/extjs/6.0.1/examples/kitchensink/#widget-grid
如果您查看 progressbarwidget
代码,您的恐惧是有根据的。
updateValue: function(value, oldValue) {
...
if (textTpl) {
me.setText(textTpl.apply({
value: value,
percent: Math.round(value * 100)
}));
}
您必须扩展 class,覆盖 updateValue
函数,并使用如下内容:
me.setText(textTpl.apply({
value: value,
percent: Math.round(value * 100),
record: me.$widgetRecord
}));
好了。