ExtJS DateField使用不同的显示格式 [英] ExtJS DateField using different display format

查看:97
本文介绍了ExtJS DateField使用不同的显示格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ExtJS DateField 控件在ASP.NET MVC Web应用程序。

I'm using a ExtJS DateField control in an ASP.NET MVC web application.

我有将格式属性设置为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 的日期格式。

为什么可以定制开箱即用,请参阅ext-3.0.0\src\locale\文件夹。包含适当的文件或只是自定义您自己的,使用文件作为模板。

For what can be customised out of the box, see the ext-3.0.0\src\locale\ 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'))

问候,
约书亚

Regards, Joshua

这篇关于ExtJS DateField使用不同的显示格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆