1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    8
    Vote Rating
    0
    hugo_alvarado is on a distinguished road

      0  

    Default [3.0rc1] DateField applyToMarkup funkiness

    [3.0rc1] DateField applyToMarkup funkiness


    Hi all,

    I have some textfields which I convert to datefileds automatically, it all has worked well up to 3.0rc1.

    The problem is that now after creating the datefilelds, the trigger (the small calendar icon on the right of the textfield) is showing over the textfield, not to the right of it. Here is a pic:


    The first datefield fine, the only difference is that there is no <label> before the text field.

    This is the html code:
    HTML Code:
    <li>
    <input  name="data[ItemForm][form_date0]"  id="ItemFormFormDate0"  value="2009-04-29"  type="text" class="datefield" />
    </li>
    
    <li>
    <label>Fecha<em>*</em>:</label>
    <input  name="data[ItemForm][form_date]"  id="ItemFormFormDate"  value="2009-04-29"  type="text" class="datefield" /></li>
    
    This is how I create the date field.

    Code:
    var dh = Ext.DomHelper;
    	var els = Ext.get(Ext.query("input.datefield"));
    	
    	for(var i=0; i<els.elements.length; i++)
    	{
    		var el = els.elements[i];
    		var d = new Ext.form.DateField({
    			el: el.dom,
    			allowBlank: false,
    			format:'Y-m-d'
    		});
    		d.applyToMarkup(el);
    		/*
    		fix for date picker in 3.0 ext js, this pushes the trigger to the right so it looks normal again
    		*/
    		d.trigger.setLeft(328);
    	}

    It is probably a CSS thing with my label because if I remove the label's css the fields render fine (but bellow the label not to the right of it like I want...)

    Code:
     label{
    	width: 150px;
    	display:table;
    	float:left;
    	clear:left;
    	vertical-align: top;
    	padding-left: 10px;
    }

    Any ideas on what I need to change to my css to have the trigger respect the label width and not have to move it to the right via js?

    Thanks!

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    does position:relative; work?

    if it doesn't you might want to expect the markup + css for an actual Ext.form.Field in an Ext.form.FormPanel for clues.

Thread Participants: 1