Setting ID's in Ext.form.DateField? - Ext JS

1782 단어 extUP
Is there a way to set the Ext.form.DateField 'id' and 'name' before render?
This doesn't work:
function setup() {
  var d = new Ext.form.DateField({id:'test_form', name:'test_name'});
  d.render('container');
  d.setValue('01/01/08');
}

I end up with this:
<div id="container">
<div style="width: 109px;" id="ext-gen7" class="x-form-date-wrap"><input title="" class="x-form-field" id="ext-gen6" size="16" autocomplete="off" type="text"></div></div>
  


    <input name="commit" value="Create" type="submit">
  </p>
</form>

On the list of Ext sugar to make things sweet: it would be great if we could just specify a field name to transform into a date picker.
A nice time picker would make my day too.
  #
2  
02-28-2007, 11:04 AM
In the next rev coming shortly you can do all of the following:
var d = new Ext.form.DateField({
     id:'test_form', 
     name:'test_name'
});
d.render('container');
d.setValue('01/01/08');

var d = new Ext.form.DateField({
     id:'someId'   // <-- name will default to id
});
d.render('container');
d.setValue('01/01/08');


var d = new Ext.form.DateField({
     id:'test_form', 
     name:'test_name',
     value: '01/01/08'
});
d.render('container');


var d = new Ext.form.DateField({
     target:'existing-element', // <-- does not mess with id or name
     value: '01/01/08'
});

좋은 웹페이지 즐겨찾기