GoodNews.panel.Categories = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'goodnews-panel-categories'
,title: _('goodnews.categories')
,defaults: {
border: false
}
,items:[{
html: '<p>'+_('goodnews.categories_management_desc')+'</p>'
,border: false
,bodyCssClass: 'panel-desc'
},{
xtype: 'goodnews-grid-categories'
,cls: 'main-wrapper'
,preventRender: true
}]
,listeners: {
'activate': {fn: function() {
Ext.getCmp('goodnews-grid-categories').refresh();
}
,scope: this}
}
});
GoodNews.panel.Categories.superclass.constructor.call(this,config);
};
Ext.extend(GoodNews.panel.Categories,Ext.Panel);
Ext.reg('goodnews-panel-categories', GoodNews.panel.Categories);GoodNews.grid.Categories = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'goodnews-grid-categories'
,url: GoodNews.config.connectorUrl
,baseParams: { action: 'mgr/category/getList' }
,fields: [
'id'
,'name'
,'description'
,'goodnewsgroup_id'
,'goodnewsgroup_name'
,'membercount'
,'public'
,'menu'
]
,grouping: true
,groupBy: 'goodnewsgroup_name'
,singleText: _('goodnews.category')
,pluralText: _('goodnews.categories')
,primaryKey: 'name'
,sortBy: 'name'
,sortDir: 'ASC'
,paging: true
,remoteSort: true
,emptyText: _('goodnews.categories_none')
,save_action: 'mgr/category/updateFromGrid'
,autosave: true
,autoExpandColumn: 'description'
,collapseFirst: false
,columns: [{
header: _('goodnews.id')
,dataIndex: 'id'
,sortable: true
,width: 30
},{
...This question has been answered by gadgetto. See the first response.
Ext.getCmp('goodnews-panel-categories').doLayout();Let try the other way around.
After the grid's is rendered, tell the parent component to fix layout.
On grid's config, add listeners: "afterrender", which has this:Ext.getCmp('goodnews-panel-categories').doLayout();
,preventRender: true
How about to addon GoodNews.panel.Categories ?,preventRender: true
afterrender: function(panel) {
panel.doLayout();
}
afterrender: function(panel) {
setTimeout(function(){panel.doLayout();}, 5);
}
Ext.getCmp('goodnews-panel-categories').doLayout();
// usually returns as "undefined", but it is working on the page.
Ext.getCmp('other_component_id').doLayout();
Ext.getCmp('other_component_id').doLayout();
$this->addHtml('<script type="text/javascript">
Ext.onReady(function(){
MODx.add("goodnews-panel-home");
});
</script>');
GoodNews.HomePanel = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'goodnews-panel-home'
,cls: 'container'
,bodyStyle: ''
,unstyled: true
,items: [{
html: '<h2 class="gon-cmp-header gon-logo">'+_('goodnews.management')+'</h2>'
,border: false
,cls: 'modx-page-header'
},{
xtype: 'modx-tabs'
,itemId: 'tabs'
,cls: 'structure-tabs'
,items: [{
xtype: 'goodnews-panel-newsletters'
},{
xtype: 'goodnews-panel-subscribers'
},{
xtype: 'goodnews-panel-groups'
},{
xtype: 'goodnews-panel-categories'
}]
}]
});
GoodNews.HomePanel.superclass.constructor.call(this,config);
this.init();
};
Ext.extend(GoodNews.HomePanel,MODx.Panel,{
...
GoodNews.panel.Newsletters = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'goodnews-panel-newsletters'
,title: _('goodnews.newsletters')
,defaults: {
border: false
}
,items:[{
html: '<div>'+_('goodnews.newsletters_management_desc')+'</div>'
,border: false
,bodyCssClass: 'panel-desc'
},{
xtype: 'goodnews-grid-newsletters'
,cls: 'main-wrapper'
,preventRender: true
}]
});
GoodNews.panel.Newsletters.superclass.constructor.call(this,config);
};
Ext.extend(GoodNews.panel.Newsletters,Ext.Panel);
Ext.reg('goodnews-panel-newsletters', GoodNews.panel.Newsletters);
GoodNews.grid.Newsletters = function(config) {
config = config || {};
// A row expander for newsletter grid rows (additional informations)
this.nlexpander = new Ext.ux.grid.RowExpander({
tpl: new Ext.Template(nlInfos)
,enableCaching: false
});
Ext.applyIf(config,{
id: 'goodnews-grid-newsletters'
,url: GoodNews.config.connectorUrl
,baseParams: { action: 'mgr/mailing/getList' }
,fields: [
'id'
,'pagetitle'
...
...
...
,'menu'
]
,emptyText: _('goodnews.newsletters_none')
,paging: true
,remoteSort: true
,plugins: [this.nlexpander]
,autoExpandColumn: 'pagetitle'
,columns: [
...
GoodNews.HomePanel = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'goodnews-panel-home'
,cls: 'container'
,bodyStyle: ''
,unstyled: true
,items: [{
html: '<h2 class="gon-cmp-header gon-logo">'+_('goodnews.management')+'</h2>'
,border: false
,cls: 'modx-page-header'
},{
xtype: 'modx-tabs'
,itemId: 'tabs'
,cls: 'structure-tabs'
,items: [{
xtype: 'goodnews-panel-newsletters'
},{
xtype: 'goodnews-panel-subscribers'
},{
xtype: 'goodnews-panel-groups'
},{
xtype: 'goodnews-panel-categories'
}]
,listeners: {
'tabchange': {fn: function(panel) {
panel.doLayout();
}
,scope: this}
}
}]
});
GoodNews.HomePanel.superclass.constructor.call(this,config);
this.init();
};
Ext.extend(GoodNews.HomePanel,MODx.Panel,{
...
GoodNews.panel.Newsletters = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'goodnews-panel-newsletters'
,title: _('goodnews.newsletters')
,layout: 'anchor'
,defaults: {
border: false
}
,items:[{
html: '<div>'+_('goodnews.newsletters_management_desc')+'</div>'
,border: false
,bodyCssClass: 'panel-desc'
},{
xtype: 'goodnews-grid-newsletters'
,cls: 'main-wrapper'
,preventRender: true
}]
});
GoodNews.panel.Newsletters.superclass.constructor.call(this,config);
};
Ext.extend(GoodNews.panel.Newsletters,Ext.Panel);
Ext.reg('goodnews-panel-newsletters', GoodNews.panel.Newsletters);