PDA

View Full Version : the render event of a dateField isn't fired



flamant
4 May 2011, 3:49 AM
Hi,

I build a DateField on which I add a render listener



result = new Ext.form.DateField({
id: "I" + fieldId,
name: "I" + fieldId,
hideLabel: true,
allowBlank: allowBlank,
defaultAllowBlank : (field.fldMode == 'M' ? false : true),
fldMode: field.fldMode,
fldDp: field.fldDp,
fldMc: field.fldMc,
helpText: field.fldText,
style: buildStyle(field.bold, field.fontSize, field.textColor, field.align, field.italic),
format: 'dMY',
defaultFormat : 'dMY',
altFormats: 'dMY|MY|Y',
x: powerBuilderXUnitsToPixels(field.fldX) + gridLeftMargin,
y: powerBuilderYUnitsToPixels(field.fldY),
width: powerBuilderXUnitsToPixels(field.fldLength) + 30,
height: powerBuilderYUnitsToPixels(field.fldHeight) - 5,
hidden: (field.fldMode == 'I' ? true : (field.visibility == false ? true : false)),
defaultValue: defaultValue,
hideTrigger: true,
rowId: rowId,
rowSeq: rowSeq,
dtStrict: dtStrict,
defaultDtStrict : field.dtStrict,
dtPast: dtPast,
defaultDtPast : field.dtPast,
readOnly: readOnly,
screenSequence: screenSequence,
subjectId: subjectId,
fieldId: field.fldId,
fldMode: field.fldMode,
initData: null,
disabled: disabled,
screenId: screenId,
sptNbr: sptNbr,
invDeaField: invDeaField,
maskRe: regex,
validator: function (val) {
var field = this;
return validDate(val, field);
},
listeners: {
change: function(field, newValue, oldValue) {
setDateRawValue(field);
dataChanged = true;
if (this.initData != null) {
plainInitDataChanged = true;
}
resetConstraint(field, this.rowId);
resetDatPenMisCon(field, false);
updateGridVisibility(field);
updateFieldVisibility(field);
},
render : function(dateField) {
var elt = dateField.getEl();
elt.field = dateField;
elt.on('dblclick', function(evt, elRef) {
var field = this.field;
if (!field.readOnly) {
field.onTriggerClick();
}
})
}
}
});


This DateField is added to a Ext.Panel

and I don't know why, the render listener is sometimes not called when I load my page. Sometimes it is....

Thank you in advance for your answers