ExtJS DateField 使用不同的显示格式 [英] ExtJS DateField using different display format
问题描述
我正在使用 ExtJS DateField ASP.NET MVC Web 应用程序中的控件.
I'm using a ExtJS DateField control in an ASP.NET MVC web application.
我已将 format
属性设置为Ymd",以便它可以正确解析来自服务器的2009-08-11"格式,并以该格式发回.
I've set format
property to "Y-m-d", so that it'll correctly parse the "2009-08-11" format from the server, and will also send it back in that format.
但是,我想以一种不同的、更加用户友好的格式显示数据,尤其是西班牙语中的d mmm yyyy".
However, I'd like to display the data in a different, more user-friendly, format, particularly "d mmm yyyy" in Spanish.
我似乎无法弄清楚如何做到这一点.我认为 altFormats
属性没有帮助,因为它只会添加更多解析格式.
I can't seem figure out how to do this. I don't think the altFormats
property is of help, since that just adds more parse formats.
是否可以使用与显示格式不同的解析格式?还是我的方法不对?
Is it possible to use a different parse format from display format? Or am I going about this the wrong way?
推荐答案
是的.这是可能的.
参见 http://extjs.com/deploy/dev/docs/?class=Date 用于日期格式.
See http://extjs.com/deploy/dev/docs/?class=Date for date formats.
有关可以立即自定义的内容,请参阅 ext-3.0.0srclocale 文件夹.包含适当的文件或仅自定义您自己的文件,使用其中一个文件作为模板.
For what can be customised out of the box, see the ext-3.0.0srclocale folder. Include the appropriate file or just customize your own, using on of the files as a template.
例如:
Date.monthNames = [
"Januar",
"Februar",
"Marec",
"April",
"Maj",
"Junij",
"Julij",
"Avgust",
"September",
"Oktober",
"November",
"December"
];
Date.dayNames = [
"Nedelja",
"Ponedeljek",
"Torek",
"Sreda",
"Četrtek",
"Petek",
"Sobota"
];
console.log((new Date()).format('Y-M-D'))
问候,约书亚
这篇关于ExtJS DateField 使用不同的显示格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!