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