[CLOSED] NumberField text layout

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] NumberField text layout

    Hi,

    I'm curious if the default behavior of NumberField can be modified such that the text is left-aligned and the cursor is positioned following the text in the control.
    Last edited by Daniil; Nov 16, 2012 at 2:11 PM. Reason: [CLOSED]
  2. #2
    Hello

    I'm sorry but I don't quite understand you. Can you give more information or example?
  3. #3
    Edit: tried to help for wrong version of ext. My bad, sorry.
    Last edited by jwf; Nov 14, 2012 at 11:05 PM.
  4. #4
    If @jwf was right about your problem that you need change writing direction of input field. You can use CSS direction property:

    <ext:NumberField runat="server" FieldLabel="Number" Width="200" StyleSpec="direction: rtl;" />
  5. #5
    Quote Originally Posted by Baidaly View Post
    If @jwf was right about your problem that you need change writing direction of input field. You can use CSS direction property:

    <ext:NumberField runat="server" FieldLabel="Number" Width="200" StyleSpec="direction: rtl;" />
    Thanks for your responses guys! Unfortunately, including StyleSpec="direction: rtl;" didn't make any difference.
  6. #6
    Sorry, but can you give more information or picture of what do you want? I'm just not sure what do you mean.
  7. #7
    I just want to swap the text and the NumberField icon so that the text becomes left-aligned and icon, respectively, right-aligned. Please refer to the screenshot of existing control attached.

            .icon-number
            {
                background-image: url(./Images/number.png) !important;
                background-position: 0 0;
            }
                                
    <ext:NumberField runat="server" ID="Number1" AllowDecimals="false" AllowNegative="false"
                                    IconCls="icon-number" MaxLength="10" SelectOnFocus="true">
    Attached Thumbnails Click image for larger version. 

Name:	Screen1.png 
Views:	101 
Size:	1.0 KB 
ID:	5086  
  8. #8
    Try this one:

    <ext:NumberField runat="server" FieldLabel="Number" Width="200" StyleSpec="text-align: right;" />
  9. #9
    Quote Originally Posted by Baidaly View Post
    Try this one:

    <ext:NumberField runat="server" FieldLabel="Number" Width="200" StyleSpec="text-align: right;" />
    That doesn't work. BTW, what's the rationale behind designing the NumberField default behavior the way it is? If it makes common sense, I could probably try to convey it to my BAs without making modifications.
  10. #10
    OK, I got it.

    You have to use following overriding:

    <script>
    Ext.override(Ext.form.TextField, {
    	setIconCls : function (iconCls) {
    		if (this.isIconIgnore()) {
    			return;
    		}
    	
    		if (!this.icon) {
    			this.renderIconEl();
    
    			this.on("hide", function () {
    				this.icon.hide();
    			});
    
    			this.on("show", function () {
    				this.icon.show();
    			});
    		}
    
    		this.iconCls = iconCls;
    		this.icon.dom.className = "x-textfield-icon " + iconCls;
    		this.icon.applyStyles({
    			left: this.getWidth() - this.icon.getWidth() - 3
    		});
    		if (this.hidden) {
    			this.icon.hide();
    			this.on(
    				"show", 
    				function () {
    					this.syncSize();
    				}, 
    				this, { 
    					single : true
    				});
    		} else {
    			this.syncSize();
    		}
    	}
    });
    </script>
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] How to add text to a collapsed region of border layout
    By ISI in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 06, 2012, 12:04 PM
  2. Replies: 2
    Last Post: Jul 11, 2012, 5:18 PM
  3. [CLOSED] NumberField zero empty text and value
    By kemalyigit in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 23, 2012, 11:30 AM
  4. [CLOSED] vbox layout inside column layout
    By craig2005 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 04, 2011, 2:44 PM
  5. [CLOSED] numberfield text
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 02, 2010, 4:06 PM

Tags for this Thread

Posting Permissions