Hybrid View
-
23 Feb 2011 10:22 AM #1
[CLOSED]hbox layout: layoutConfig parameters 'pack' and 'align' not working
[CLOSED]hbox layout: layoutConfig parameters 'pack' and 'align' not working
It seems like layoutConfig parameters 'pack' and 'align' are not working on layout hbox like they used to.
does not put items into the center / middle of hbox.Code:layout: 'hbox', layoutConfig: { pack: 'center', align: 'middle' },
Can this be confirmed as a bug?
Thanks!
-
23 Feb 2011 2:22 PM #2
-
24 Feb 2011 12:23 AM #3
Can you please post a full test case? Looks like this may already be resolved:
hbox.jpgCode:Ext.require('*'); Ext.onReady(function() { new Ext.Container({ width: 600, height: 400, renderTo: document.body, layout: { type: 'hbox', align: 'middle', pack: 'center' }, items: [{ xtype: 'button', text: 'Foo' }] }); });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Feb 2011 4:42 AM #4
This is one of those cases where things changed from Ext3 to Ext4:
- when providing 'layout' as object everything works in Ext4 like in Ext3
- when providing 'layout' as string with layoutConfig as object, Ext4 does not work since layoutConfig seems to have been dropped.
Also Ext4 seems to interpret defaults: {padding: 10} incorrectly when using layout 'hbox': Padding does not increase the space between component border and component content as expected. When using layout 'border' it works as expected.
Testcase:
Good to know it works in Ext4 when providing 'layout' as object.Code:Ext.onReady(function(){ // ---- Create Viewport with hbox layout ---------------------- Ext.create('Ext.Viewport',{ // ExtJS 3 param 'layoutConfig' as defined in Ext.Container does not exist anymore in ExtJS4 // instead in ExtJS 4 'layout' as defined in Ext.AbstractContainer needs to be // provided as object when wanting to specify config params for layout // // this works in ExtJS 3 AND ExtJS 4 preview 1 // //layout: { // type: 'hbox', // pack: 'center', // align: 'middle' //}, // // // this only works in ExtJS 3 but NOT in 4 layout: 'hbox', layoutConfig: { pack: 'center', align: 'middle' }, defaults: { // padding does NOT work as expected in ExtJS4 preview 1 when using hbox layout, // it does not increase spacing between component border and content padding: 10, border: true }, items:[ { title: 'Panel one', html: '<h2>I am panel 1</h2>', width: 100, height:80 }, { title: 'Panel 2', html: '<h2>I am panel 2</h2>', width: 120, height: 100 }, { title: 'Panel 3', html: '<h2>I am panel 3</h2>', width: 140, height: 120 } ] }); // END of onReady });
Thanks!
Jan Harmsen
-
24 Feb 2011 4:55 AM #5
Padding adds padding to the component itself. If you want to add padding to the content, use bodyPadding.
I'll add a note re: layoutConfig being gone.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Feb 2011 5:21 AM #6
interesting, param 'bodyPadding' is another one of those new config params in Ext4 that did not exist before.
It might be worth pointing that out in the docs ('padding' defined in Ext.AbstractContainer vs 'bodyPadding' in Ext.panel.Panel)
Anyway, thanks for letting me know!
Jan
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
hbox layout and align strech
By gkatz in forum Sencha Touch 1.x: DiscussionReplies: 4Last Post: 6 Dec 2012, 5:11 AM -
[CLOSED] [3.3.x] IE8 bug: hbox with pack: 'end' and formlayout child
By nsolsen in forum Ext 3.x: BugsReplies: 2Last Post: 3 Dec 2010, 8:25 AM -
Align items in layout HBOX
By aperez in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 6 Aug 2010, 3:17 AM -
Bug ? HBox Layout not working under IE 8 ?
By eks8fe in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 26 Jan 2010, 4:34 PM -
[3.0 RC3]Issue with HBox layout and Align Middle
By robertoroberto in forum Ext 3.x: Help & DiscussionReplies: 4Last Post: 6 Jul 2009, 12:43 AM


Reply With Quote