extjs 4 网格渲染器
我正在使用 extjs 设计器 1.2。我在面板上有一个按钮,单击即可打开窗口。该窗口有网格,我已在 js 文件中应用了渲染器,如下所示。问题是,当窗口第一次打开时,渲染器工作得很好,但是当我关闭窗口时,渲染器工作得很好。重新打开它,效果就消失了。
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>';
}
}
});
观察:当我在 ui.js 中使用渲染器(即通过从设计器导出项目生成的文件)时,我不会遇到上述问题。有什么办法可以解决这个问题?
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 well 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能具体说明一下其中窗口和网格的实现吗?
只需检查窗口关闭操作
因为当您通过 ID 访问网格时,如果关闭操作被隐藏,则很有可能每次都使用相同的 ID 创建网格。如果 id 相同,这肯定行不通。
Can you please specify the implementation of window and grid in it.
Just check windows close action
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.