May 30, 2012, 6:09 PM
[CLOSED] Problem with Converter on Date RecordField
Hi
I am trying to overcome the problem described here:
http://forums.ext.net/showthread.php...ith-datecolumn
and in particular:
"I did not test your sample but I guess it occurs for rows have 'null' initial date, DateField returns empty string instead null
null and empty string are different values therefore you have dirty flag"
This is exactly what we are experiencing and I am using a Converter to convert any null dates from the Model:
Is there something I should be doing on my Converter to make sure the store record, when a valid date is present, is seen as a valid Date?
thank you
I am trying to overcome the problem described here:
http://forums.ext.net/showthread.php...ith-datecolumn
and in particular:
"I did not test your sample but I guess it occurs for rows have 'null' initial date, DateField returns empty string instead null
null and empty string are different values therefore you have dirty flag"
This is exactly what we are experiencing and I am using a Converter to convert any null dates from the Model:
<ext:RecordField Name="DateOfBirth" Type="Date" AllowBlank = "true" SubmitEmptyValue="Null">
<Convert Handler="debugger;if (value === null || typeof value === 'undefined') {value = '';}return value;" />
</ext:RecordField>
Now, this works and stops records being marked as dirty. However, if valid dates are present (and the Store does seem to pick them up, for example, we get a value of "1966-04-05T00:00:00.000"), when the record is loaded into the form via loadRecord(record)
the DateField set to display the value doesn't seem to recognise the value as a date and doesn't display it - it displays blank. When the store record is then updated via updateRecord(record)
the store record's date field is set to an empty string, the value from the DateField. Is there something I should be doing on my Converter to make sure the store record, when a valid date is present, is seen as a valid Date?
thank you
Last edited by Daniil; Jun 08, 2012 at 2:26 PM.
Reason: [CLOSED]