[英]Extjs where to add a dynamically created panel object to my existing panel
In my code, I create a panel object like below: 在我的代码中,我创建了一个如下的面板对象:
var grid = Ext.create('Ext.grid.Panel', {}); var grid = Ext.create('Ext.grid.Panel',{});
Then I am trying to define a widget which should contain the above panel as one of it's items. 然后,我试图定义一个小部件,其中应包含上面的面板作为其中的一项。 I got the definition of my widget working fine. 我的小部件定义正常。 But how can I include the above grid object so that it is rendered as part of the widget: 但是,如何包含上面的网格对象,使其作为小部件的一部分呈现:
Ext.define('Ext.simplegridwidget.GridTest', {
extend: 'Ext.panel.Panel',
alias: 'widget.gridtest',
title: 'User Management'
});
An even better approach so that everything related to my widget stays within the class definition... 一种更好的方法,使与我的小部件相关的所有内容都保持在类定义之内...
Ext.define('Ext.simplegridwidget.GridTest', {
extend: 'Ext.panel.Panel',
alias: 'widget.gridtest',
title: 'User Management',
initComponent: function() {
var grid = Ext.create('Ext.grid.Panel', {});
Ext.apply(this, {
items: [ grid, details]
});
return this.callParent(arguments);
}
});
Ok.. figured it out. 好..想通了。 Not too difficult after all... 毕竟不太难...
var grid = Ext.create('Ext.grid.Panel', {});
Ext.define('Ext.simplegridwidget.GridTest', {
extend: 'Ext.panel.Panel',
alias: 'widget.gridtest',
title: 'User Management',
items: [grid]
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.