Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

在本文中,将学习如何配置Form元素的日期选择器,以及如何根据下面的示例来影响其他元素。

本文的目标是将与日期选择器(日期元素)相关的所有内容都配置为单个格式,即dd-mm-yyyy, 并且能够使用相同的日期元素正确地对记录进行排序。

Image Added

图1:表单日期选择器配置

根据日期选择器上面的配置,当选择一个日期时(例如2016年6月2日),将会向用户显示02-06-2016这是因为  显示格式 设置为 

In this article, one will learn on how to configure the Form element's 日期选择器 and on how it would affect other elements down the line based on the sample below.

The objective of this article is to configure everything that is related to date picker (date elements) to a single format, which is dd-mm-yyyy and to be able to sort records correctly using the same date element too.

Image Removed

Figure 1: Form Date Picker Configurations

Based on the configurations above on 日期选择器, when one picks a date, (e.g. June 2, 2016), it will display 02-06-2016 to the user. This is because the Display Format is set to dd-mm-yy.

当提交表单时,它将被存储为  When the form is submitted, it will be stored as 2016-06-02 because the Data Format is set to 02, 因为  数据格式 设置为  yyyy-MM-dd.

Figure 2: Date Formatter Configurations

图2:日期格式化程序配置

表格提交后,将被存储为  When the form is submitted, it will be stored as 2016-06-02

When one view the records submitted in a Datalist, the date value shown will be based on the Data Format set earlier. Therefore, to make the date to show in our desired format, we will need to make use of the 日期格式化 with the configurations as shown above.

当查看Datalist中提交的记录时,显示的日期值将基于之前设置的  数据格式因此,为了使日期以我们想要的格式显示,我们将需要使用日期格式化 ,并配置如上所示。

基于这个日期列的排序将作为基于数据格式yyyy-MM-dd的排序工作Sorting based on this date column will work as sorting is based on data format, yyyy-MM-dd.

Info
titleGood to know

All form fields will be treated and saved as string/characters to maintain flexibility in form design.所有表单字段将被处理并保存为字符串/字符以保持表单设计的灵活性。

Figure 3: Date Range Filter Configurations

Likewise, in order to make use of any filter (i.e. Date Range Filter) in relation to the date picker's form element, one should also configure the Display Format and Data Format according to the format first set in Date Picker itself as shown in the figure above.

...

图3:日期范围过滤器配置

同样,为了使用与日期选择器的表单元素有关的任何过滤器(即日期范围过滤器),还应该根据日期选择器本身中首先设置的格式来配置  显示格式 和  数据格式 ,如图中所示以上。

教程视频:

Widget Connector
urlhttps://www.youtube.com/watch?v=olqYWeD3h0Q

...

示例应用程序

View file
nameAPP_dateSampleApp-1-20160602170128.jwa
height250