在标签面板中,有一个像这样的对象:
tabpanel.counter = 3;
在 tabpanel 中,有一个 tab t。在 t 内部,有一个网格面板。网格面板中的一列需要使用渲染器。在渲染器函数中,记录、存储、单元格、行、列等可用。
但是在渲染器函数中,有没有办法访问在 tabpanel 范围内定义的计数器对象?渲染器函数默认运行的范围是什么?ColumnModel 还是 GridPanel?
渲染器函数的默认范围是调用渲染器函数的列。但是您可以通过指定渲染器函数及其执行范围(this reference)来指定渲染器函数的作用域,例如:
renderer: {
fn: this.gridRenderer,
scope: this //change this to change scope (this reference), i.e scope: tabpanel
}
此答案取自 Ext.grid.Column 渲染器函数的 extjs API 文档http://extjs/docs/index.html?class=Ext.grid.Column