PDA

View Full Version : How do I use a spinner where the display value is different from value?



johnterran
22 Nov 2011, 3:47 PM
Hi,

How do I use a spinner where display value is different from value?
ie.
I have a spinner with the values being the date format, but when I display the value,
I want to display the formatted date, instead of the format itself.
I tried processRawValue but this isn't it.

xtype: 'spinnerfield',
fieldLabel: 'Date Format',
options: ["F j, Y", "D, F j, Y", "m-d-Y", "Y-m-d", "m/d/Y", "Y/m/d"], // this is my field
processRawValue: function(v) {
return Ext.Date.format(new Date(), v);
},

Thanks
John

mitchellsimoens
23 Nov 2011, 6:34 AM
Are you only using the core or are you using Ext JS 3/4?

johnterran
5 Dec 2011, 6:10 PM
I am using ExtJS 4

lorezyra
6 Dec 2011, 3:52 PM
You should consider using separate components (spinner fields) for each section of the date time... Then merge the values of those spinner fields into a single hidden form element using the desired format.