Hybrid View
-
1 Mar 2011 7:06 PM #1
Ext.MesasgeBox.buttonText in-line width set and cannot be changed after - IE7 Only
Ext.MesasgeBox.buttonText in-line width set and cannot be changed after - IE7 Only
This is for 2.2.1
I am changing the value of Ext.MessageBox.buttonText.ok to 'Confirm', which displays perfectly the first time the message box is shown. However, due to some needed logic I am changing Ext.MessageBox.buttonText.ok to 'OK', and once I do this an in-line style width of 20px is applied to the <SPAN> surrounding the button's text and cannot be removed. Meaning that if I set Ext.MessageBox.buttonText back to 'Confirm' only 'Cor' is displayed in the button. This only happens in IE7. Has anyone encountered this before?
You can test this function in IE7 by toggling between the following two function calls...Code:function displayAlertMsg(msgText, msg) { Ext.MessageBox.buttonText.ok = msg; Ext.MessageBox.show({ title : 'Alert', msg : msgText, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.WARNING }); return; }
Thank you in advance for any advice on solving this!Code:displayAlertMsg('This is a test message!', 'Confirm'); displayAlertMsg('This is a test message!', 'OK');
-
7 Mar 2011 11:58 AM #2
I found a solution, and if there is a more elegant solution out there let me know.
The problem is that this.btnEl is undefind in Ext.Button.autoWidth(). The workaround is in red.
Code:Ext.override( Ext.Button, { autoWidth:function() { if(this.el){ this.el.setWidth("auto"); if(Ext.isIE7 && Ext.isStrict){ var ib = this.btnEl || this.el; if(ib && ib.getWidth() > 20){ ib.clip(); ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr')); } } if(this.minWidth){ if(this.el.getWidth() < this.minWidth){ this.el.setWidth(this.minWidth); } } } } });
Similar Threads
-
updating select width on label content changed
By hulek89 in forum Sencha Touch 1.x: DiscussionReplies: 2Last Post: 24 Jan 2011, 4:36 AM -
Tabs' width in a layout is not changed when the region width changes
By maya in forum Ext 1.x: Help & DiscussionReplies: 8Last Post: 3 Jun 2008, 12:47 AM -
Ext2.0--How to use buttonText option in MessageBox
By cprabha in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 20 Mar 2008, 12:41 AM


Reply With Quote