PDA

View Full Version : manipulate wrapper div



steffenk
3 Aug 2009, 1:00 PM
Hi,

i convert date-fields to Ext.form.DateField. Now i need to apply CSS styles to the wrapper div and need help how to address. Each styles are applied to the input field.


dateFields.each(function(el) {
var ck = el.prev("input");
ck.dom.setStyle("float:left");
var dp = new Ext.form.DateField({
format: 'd-n-Y',
altFormats: 'd.n.Y|Y-n-d|d-m-Y|Y-m-d|d.m.Y',
applyTo: el.dom,
width: 200,
height: 12
});
// how to address the wrapper div (x-form-field-wrap x-form-field-trigger-wrap) ?
wrapper.setStyle({marginTop: '10px'});
});

steffenk
4 Aug 2009, 12:25 AM
solved:

dp.wrap.dom.setStyle({marginTop: '10px'});

steffenk
5 Aug 2009, 3:24 AM
one additional question:


dp.wrap.dom.setStyle({marginTop: '10px'});
doesn't work on IE. does anyone know why?

I had to fix it like this:

if (Ext.isIE) {
dp.wrap.dom.style.marginTop = '4px';
dp.wrap.dom.style.float = 'left';
} else {
dp.wrap.dom.setStyle({marginTop: '4px',float:'left'});
}

but i would expect setStyle work on any DOM ?