在主题 Xpages 中的视图列/日期字段上设置区域设置 [英] Set locale on view columns/date fields in theme Xpages

查看:17
本文介绍了在主题 Xpages 中的视图列/日期字段上设置区域设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在每个日期字段组件/编辑框组件/视图列上设置区域设置非常耗时.是否可以将它们设置为主题?

Setting the locale on every date field component/editbox component/view column is time consuming. Is it possible to set them in a theme?

更清楚:我们将应用程序发送给多个客户,以便在他们的服务器上运行.客户对如何显示和输入日期有不同的需求,具体取决于适用于其原产国的区域设置.我们有许多视图显示带有日期的数据,今天我们将所有日期列转换器区域设置为客户所在的国家/地区;瑞典语 (sv)、荷兰 (nl)、丹麦 (da)……每当我们为新客户安装应用程序时,我们都需要修改每个日期列的转换器区域设置.我希望它更像是一个中心设置,我想为什么不在主题中?

To be more clear: We ship an application to several customers to be run on their servers. Customers have different needs on how date should be displayed and entered depending on the regional setting applicable for their country of origin. We have many views displaying data with dates and today we set all date columns converter locale to whatever the client's country is; Swedish (sv), Netherland(nl), Denmark (da)… Whenever we install the application at a new customer we need to modify every date column's converter locale setting. I'd like it to be more of a central setting and I thought why not in a theme?

推荐答案

我不确定您对语言环境"设置的含义.你是说转换器吗?要从主题设置转换器,您可以使用属性 converter 并用 SSJS 代码填充它:

I am not sure what you are meaning with the "locale" setting. Do you mean a converter? To set a converter from a Theme, you can use the property converter and fill it with SSJS code:

<control>
  <name>DateConverter</name>
  <property mode="override">
     <name>converter</name>
     <value>#{javascript:
         var converter = new com.ibm.xsp.convert.DateTimeConverter();
         converter.setPattern("MMMM yy");
         return converter
     }</value>
   </property>
</control>

然后您可以将 themeId 添加到您想要的每个组件中:

Then you can add the themeId to every component you want:

<xp:inputText id="inputText1" value="#{javascript:@Now()}" themeId="DateConverter" />

这篇关于在主题 Xpages 中的视图列/日期字段上设置区域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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