PDA

View Full Version : Setting grid date field formats from a variable (or function)



furball
2 Sep 2013, 6:33 AM
Hi,

Is there any way of setting the format on grid date fields from a variable? I have a grid with several date fields in it where the format may need to be user defined. If they were all the same format, I can see I would set the Ext.Date.defaultFormat to override them, but I've got a mixture of Date & DateTime formats and this doesn't work, because you can only specify one format.

I've tried just referencing a variable in the format field, but because Architect (v2.2.2 build 991) automatically surrounds the value you enter with quotes, what you end up with in the generated JavaScript file is a literal value, like 'MyApp.dateFormat', which the application tries to parse as the format.

If I hand edit the generated JavaScript and remove the quotes, then the variable is interpreted correctly, and I get the required result, but of course, as soon as I save the Architect project again, the quotes get added back in.

Does anyone know of a way around this problem?

Cheers

Lance

furball
3 Sep 2013, 12:10 AM
Got round it in the end by creating a 'process' function and setting config.format in that.

Lance