开发者

extjs 4 grid renderer

i m working with extjs designer 1.2. I have a button on panel that opens window on click. The window has grid for which i have applied renderer as following in js file . The problem is renderer works wel开发者_StackOverflow中文版l when the window opens up for first time, but when i close window & reopen it, the effect goes off.

Ext.define('MyApp.view.TestPanel', {
    extend: 'MyApp.view.ui.TestPanel',

    initComponent: function() {
        var me = this;
        me.callParent(arguments);
        Ext.data.StoreManager.lookup('Test').load();
        me.down('button[id=testbutton]').on('click',me.onTestBtnClick,me); 
    },

    onTestBtnClick:  function(){

        var win = new Ext.create('MyApp.view.TestWindow');
        win.show();
        win.down('#testgrid').columns[0].renderer=function(val){
             return '<span style="color:red;">' + val + '</span>';
            }

    }
});

Observation : When i use renderer in ui.js i.e. the file generated by exporting project from designer, i dont face above stated problem. What can be solution for this problem?


Can you please specify the implementation of window and grid in it. Just check windows close action

closeAction : String

The action to take when the close header tool is clicked: 'destroy' : remove the window from the DOM and destroy it and all descendant Components. The window will not be available to be redisplayed via the show method. 'hide' : hide the window by setting visibility to hidden and applying negative offsets. The window will be available to be redisplayed via the show method.

Note: This behavior has changed! setting does affect the close method which will invoke the approriate closeAction. Defaults to: "destroy"

Because as you are accessing the grid through ID and if close action is hide then its quite possible that each time grid is getting created with same ID. And if id is same surely this will not work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜