View Full Version : [FIXED][3.0.0] labelStyle resets the labelWidth property

9 Jul 2009, 2:13 AM
If I would like to set labelStyle on some particular form field (having different label color, for example, it kills such styles as label width, defined in form labelWidth property):

this.panel = new Ext.FormPanel({
labelWidth: 85,
items: [
{fieldLabel: 'First Name', name: 'FIRST_NAME'},
{fieldLabel: 'Last Name', name: 'LAST_NAME'},
{fieldLabel: 'Company', name: 'COMPANY', labelStyle: 'color: gray'},

Company field will look ugly, because label's width will be reset.

9 Jul 2009, 3:09 AM
This has been fixed in the trunk version.

9 Jul 2009, 3:43 AM
Here is the bugreport (http://extjs.com/forum/showthread.php?t=48114) for the 2.x branch.

30 Jul 2009, 4:58 AM
I took trunk from svn today and have similar problem that labelStyle reset labelWidth

<script type='text/javascript'>

var field = new Ext.form.DisplayField({
name: 'Overview_TaskId',
value: 'TT007163',
maxLength: '20',
fieldLabel: 'text text text text text text text text text text text ',
readOnly: true,
allowBlank: true,
hideLabel: false,
inputType: 'text',
disabled: false,
labelStyle: 'padding-left: 2; padding-right: 2;'

var cont = new Ext.Container({
layout: 'form',
labelWidth: 300,
applyTo: 'Overview_TaskId_cmp',
autoDestroy: true,
items: [ field ]

<div id="Overview_TaskId_cmp"></div>

And here is the result, label is 300 wide but text is not.

If I remove line with labelStyle, text width is fine:

30 Jul 2009, 5:08 AM
This isn't the case, I just ran your code and the label width is 300.

Note that your padding styles are invalid, you need to specify units.

30 Jul 2009, 5:12 AM
but DisplayField label is tighter and is multiline but it shouldn't. I don't know, for me it work fine if I remove labelStyle (I assume this is related) so please give me a hint how to fix it if it's possible or point me to the solution.

30 Jul 2009, 5:17 AM
I can't offer you one, your code works as expected with the SVN version. I suggest you try grabbing the latest build again and clear your cache.

30 Jul 2009, 5:20 AM
You right. My mistake. I've tested it against 3.0 version locally by mistake. I'm really really sorry.

6 Aug 2009, 10:56 AM
Please consider adding this fix to the 3.0.x branch as well.