开发者

extjs scope of renderer

开发者 https://www.devze.com 2023-02-14 04:11 出处:网络
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 rend

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

精彩评论

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