开发者

extjs scope of renderer

Inside a tabpanel, there is an object like this:

tabpanel.counter = 3;

Inisde the tabpanel, there is a tab t. Inside t, there is a gridpanel. One of the columns in the gridpanel needs to use a renderer. In the renderer function, the record, store, cell, row , column etc are available.

But in the renderer function, is there a way to access the counter object defined at the tabpanel scope? What is the scope in which the renderer function ru开发者_JAVA技巧ns by default? ColumnModel or GridPanel?


The default scope for renderer function is Column that call the renderer function. But you can specify what scope does the renderer function by specifying both the renderer function, and its execution scope (this reference) e.g.:

renderer: {
    fn: this.gridRenderer,
    scope: this //change this to change scope (this reference), i.e scope: tabpanel
}

This answer is taken from extjs API docs for Ext.grid.Column renderer function http://extjs/docs/index.html?class=Ext.grid.Column

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜