Set locale on view columns/date fields in theme Xpages

左心房为你撑大大i 提交于 2019-12-24 01:49:15

问题


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

EDIT: 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?


回答1:


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>

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

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


来源:https://stackoverflow.com/questions/14715649/set-locale-on-view-columns-date-fields-in-theme-xpages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!