Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Bugs

Reply
 
Thread Tools
  #1  
Old 06-05-2008, 12:23 PM
JamesC JamesC is offline
Ext JS Premium Member
 
Join Date: Nov 2007
Posts: 228
JamesC is on a distinguished road
Default [2.1][FIXED] Checkbox with no boxLabel aligns badly within form

Example showing problem:

        var form = function() {

            return {
                
init : function() {
                    var 
viewport = new Ext.Viewport({
                        
layout"border",
                        
items:
                                new 
Ext.form.FormPanel({
                                    
region"center",
                                          
framefalse,
                                    
bodyStyle"padding:5px 10px 0 10px;",
                                    
autoHeighttrue,
                                    
frametrue,
                                    
id"form-ctr",
                                    
items: [{
                                        
xtype"fieldset",
                                        
layout"table",
                                        
height400,
                                        
layoutConfig: {columns2},
                                        
items: [{
                                            
layout"form",
                                            
items: [{
                                                
xtype"textfield",
                                                
fieldLabel"Text Area",
                                                
anchor"98%"
                                            
}]
                                        },{
                                            
layout"form",
                                            
items: [{
                                                
xtype"textfield",
                                                
fieldLabel"Text Field",
                                                
anchor"98%"
                                            
}]
                                        },{
                                            
layout"form",
                                            
items: [{
                                                
xtype"textfield",
                                                
fieldLabel"Text Field",
                                                
anchor"98%"
                                            
}]
                                        },{
                                            
layout"form",
                                            
items: [{
                                                
xtype"textfield",
                                                
fieldLabel"Text Field",
                                                
anchor"98%"
                                            
}]
                                        },{
                                            
layout"form",
                                            
items: [{
                                                
xtype"textfield",
                                                
fieldLabel"Text Field",
                                                
anchor"98%"
                                            
}]
                                        },{
                                            
layout"form",
                                            
items: [{
                                                
xtype"checkbox",
                                                
fieldLabel"Check Box",
                                                
anchor"0%"
                                            
}]
                                        }]
                                    }]
                                })
                            
                    });
                }
            }
        }();
        
Ext.onReady(function() {
            
form.init();
        }, 
form); 
The checkbox is misaligned, and is wrongly given by a left:-8px (given by the onResize)

My proposed fix is to only perform the alignTo if there is no boxLabel and no fieldLabel:

Ext.override(Ext.form.Checkbox, {

    
onResize : function(){
        
Ext.form.Checkbox.superclass.onResize.apply(thisarguments);
        if (!
this.boxLabel && !this.fieldLabel) {
            
this.el.alignTo(this.wrap'c-c');
        }
    }
}); 
Reply With Quote
  #2  
Old 06-12-2008, 03:09 PM
brian.moeskau's Avatar
brian.moeskau brian.moeskau is offline
Ext JS Contributor
 
Join Date: Mar 2007
Location: Austin, Texas
Posts: 3,259
brian.moeskau is on a distinguished road
Default

Updated in SVN, thanks.
__________________
Brian Moeskau
FAQ / Tutorials / User Extensions / Enhanced Forum Search
Reply With Quote
  #3  
Old 08-08-2008, 10:02 AM
Rothariger Rothariger is offline
Ext User
 
Join Date: Aug 2008
Posts: 78
Rothariger is on a distinguished road
Default

thanks... it help me a lot!
Reply With Quote
  #4  
Old 06-24-2009, 04:43 AM
Stripeman's Avatar
Stripeman Stripeman is offline
Ext User
 
Join Date: Apr 2008
Location: Heidelberg Germany
Posts: 275
Stripeman is on a distinguished road
Send a message via MSN to Stripeman
Default

I think this issue is also in the 3.x release.
No matter where i put this override.. it doesnt work when i dont specify a fieldLabel. Yes I am using 'anchor: "0%"'

Where am I to put the code?:

  Ext.override(Ext.form.Checkbox, {

        
onResize : function(){
            
Ext.form.Checkbox.superclass.onResize.apply(thisarguments);
            if (!
this.boxLabel && !this.fieldLabel) {
                
this.el.alignTo(this.wrap'c-c');
            }
        }
    }); 
Reply With Quote
  #5  
Old 06-24-2009, 07:41 AM
evant's Avatar
evant evant is offline
Ext JS - Development Team
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 8,550
evant is on a distinguished road
Default

This has been added for 3.x as well.
__________________
Evan Trimboli
Ext JS - Core Development Team
evan@extjs.com
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 12:30 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.