May 25, 2011, 8:17 AM
[CLOSED] DateField should not have a default format on the server-side
This is not actually a logic bug, but more of a design bug in my understanding. ExtJs DateField default format is n/j/y.
Ext.Net uses "d" on the server-side which somehow translates to "n/j/y" on client side (I am not sure how this translation happens). This makes it very difficult to enforce global default date format according to application needs.
We have a very large CRM deployed across boundaries and we need to enforce our default date formats according to complex rules.
I created a plugin for DateField and deployed it across client-side. So anytime "format" is not specified in DateField's config, the plugin kicks in and specifies the desired date format according to rules.
You should notice that if "format" is specified in "DateField" config, the plugin needs to honor it otherwise use the rules to specify its own.
This terribly fails because any <ext:DateField> renders with format: 'n/j/y' to the client.
So, I switched to server-side using Ext.Net.Utilities.FindControls<DateField>.
This also failed because DateField.Format defaulted to "d" on server-side. I again cannot override server-side because the developer might have actually placed "d" or "n/j/y" as the Format because for that field, this was the fixed format that should not be overwritten (imagine a DateField for Credit Card expiry dates, its format is "n/y" which should not be overwritten).
What would have been a regular task with an ExtJs plugin has turned into an almost impossible situation because <ext:ateField> enforces a Format server-side and client-side.
So, I would recommend removing default formats for <ext:DateField> on server-side, and do NOt render with "format" in config if "Format" was not specified explicitly on the server-side.
Ext.Net uses "d" on the server-side which somehow translates to "n/j/y" on client side (I am not sure how this translation happens). This makes it very difficult to enforce global default date format according to application needs.
We have a very large CRM deployed across boundaries and we need to enforce our default date formats according to complex rules.
I created a plugin for DateField and deployed it across client-side. So anytime "format" is not specified in DateField's config, the plugin kicks in and specifies the desired date format according to rules.
You should notice that if "format" is specified in "DateField" config, the plugin needs to honor it otherwise use the rules to specify its own.
This terribly fails because any <ext:DateField> renders with format: 'n/j/y' to the client.
So, I switched to server-side using Ext.Net.Utilities.FindControls<DateField>.
This also failed because DateField.Format defaulted to "d" on server-side. I again cannot override server-side because the developer might have actually placed "d" or "n/j/y" as the Format because for that field, this was the fixed format that should not be overwritten (imagine a DateField for Credit Card expiry dates, its format is "n/y" which should not be overwritten).
What would have been a regular task with an ExtJs plugin has turned into an almost impossible situation because <ext:ateField> enforces a Format server-side and client-side.
So, I would recommend removing default formats for <ext:DateField> on server-side, and do NOt render with "format" in config if "Format" was not specified explicitly on the server-side.
Last edited by Daniil; Nov 29, 2012 at 9:02 AM.
Reason: [CLOSED]