PDA

View Full Version : [CLOSED-443][3.??] Ext.Editor + autoSize gets the width wrong for spans/labels



mankz
29 Dec 2009, 1:16 AM
The width is a little too small when using the editor on a span/label with no width assigned. Test case:

http://www.extjs.com/deploy/dev/examples/simple-widgets/editor.html

Run this in Firebug (edits the panel title el)

var cfg = {
shadow: false,
completeOnEnter: true,
cancelOnEsc: true,
updateEl: true,
autoSize : 'width',
ignoreNoChange: true
};

var labelEditor = new Ext.Editor(Ext.apply({
alignment: 'l-l',
listeners: {
beforecomplete: function(ed, value){
if(value.charAt(value.length - 1) != ':'){
ed.setValue(ed.getValue() + ':');
}
return true;
},
complete: function(ed, value, oldValue){
Ext.example.msg('Label Changed', '"{0}" changed to "{1}"', oldValue, value);
}
},
field: {
allowBlank: false,
xtype: 'textfield',
selectOnFocus: true
}
}, cfg));

labelEditor.startEdit(Ext.getDom('ext-gen6'));

mankz
18 Jan 2010, 8:29 AM
*cough*

Jamie Avins
18 Jan 2010, 10:01 AM
If you put in a post that either doesn't get at least UNKNOWN or stays UNKNOWN for too long, please feel free to bump it or *cough* it up ;)

Every post here should be tagged OPEN/FIXED/INFOREQ/CLOSED/DUP within a business day.

mankz
18 Jan 2010, 10:16 AM
Thanks Jamie :) - my cough is feeling better now!

evant
19 Mar 2010, 10:06 PM
Not really sure whether you'd classify this as a bug.

The width of the span is 68px, which is exactly what the editor is sized to. We could have it fudge the size a little bit, but I'd prefer not to do that.

What are your thoughts?

mankz
20 Mar 2010, 1:29 AM
Minor bug then :)

If you change the code to edit a form label field, all is ok:



labelEditor.startEdit(Ext.getDom('ext-gen13'));


Then the field covers the whole text, which is what I expect when editing any label field. Is there any clean way to achieve this?

evant
31 Mar 2010, 1:22 AM
Because the label has had a width applied to it that it's honouring. I think you'll need to detect in certain situations where you'll need to add an offset to the size, even the example does that for the combo.

I'll close this off for now, if you feel strongly about it feel free to reopen the issue.