extjs - What is the syntax to add a panel to a viewport component? -
from examples have found, code should add newpanel
viewport
east region, nothing:
var viewport = new ext.viewport({ layout: 'border', items: [ regionmenu, regioncontent ] }); var newpanel = new ext.panel({ region: 'east', width: 300, html: 'this panel added' }); viewport.add(newpanel);
how can add new panel viewport?
addendum
i got work, here main code same issue, i'm not adding viewport region within viewport, , empty region of contents before add new contents:
ext.onready(function(){ ... regioncontent = new ext.panel({ id: 'contentarea', region: 'center', padding:'10', autoscroll: true }); var viewport = new ext.viewport({ layout: 'border', items: [ regionmenu, regioncontent ] }); clearextjscomponent(regioncontent); var start_info_panel = new ext.panel({ title: 'start info', padding: 10, width: 300, html: 'this panel added start view' }); regioncontent.add(start_info_panel); regioncontent.dolayout(); }); function clearextjscomponent(cmp) { var f; while(f = cmp.items.first()){ cmp.remove(f, true); } }
you may need call viewport.dolayout()
after add newpanel because viewport rendered:
viewport.add(newpanel); viewport.dolayout();
from add() documentation:
if container rendered when add called, may need call dolayout refresh view causes unrendered child components rendered. required can add multiple child components if needed while refreshing layout once.
Comments
Post a Comment