Skip to content

Ext.form.field.Time

xtype 为 timefield 的 Ext JS 原生组件参考。

Updated View as Markdown

源码定义:ext-all-debug.js:110226。分类:表单与字段。

创建示例

var component = Ext.create("Ext.form.field.Time", {
  xtype: "timefield",
  altFormats: "H:i:s|His|H:i:s.u|His.u|Hi|g:ia|g:iA|g:i a|g...,
  displayField: 'disp',
  format: "g:i A",
  ignoreSelection: 0,
  renderTo: Ext.getBody()
});

属性

属性 类型 默认值 说明 配置示例
altFormats String "H:i:s|His|H:i:s.u|His.u|Hi|g:ia|g:iA|g:i a|g... Multiple date formats separated by “\ “ to try when parsing a user input value and it doesn’t match the defined format.
displayField String 'disp' 下拉或选择组件显示给用户的记录字段。 displayField: 'disp'
format String "g:i A" =undefined] The default time format string which can be overriden for localization support. The format must be valid according to Ext.Date#parse. Defaults to 'g:i A', e.g., '3:15 PM'. For 24-hour time format try 'H:i' instead. format: "g:i A"
ignoreSelection Number 0 配置组件的 ignoreSelection 选项。 ignoreSelection: 0
increment Number 15 =15] The number of minutes between each time value in the list. Note that this only affects the list of suggested times. To enforce that only times on the list are valid, use #snapToIncrement. That will coerce any typed values to the nearest increment point upon blur. increment: 15
initDate String '1/1/2008' 配置组件的 initDate 选项。 initDate: '1/1/2008'
initDateFormat String 'j/n/Y' 配置组件的 initDateFormat 选项。 initDateFormat: 'j/n/Y'
invalidText String "{0} is not a valid time" The error text to display when the time in the field is invalid. invalidText: "{0} is not a valid time"
maxText String "The time in this field must be equal to or b... The error text to display when the entered time is after #maxValue. maxText: "The time in this field must be equal to or b...
maxValue Date/String - The maximum allowed time. Can be either a Javascript date object with a valid time value or a string time in a valid format – see #format and #altFormats. maxValue: "示例值"
minText String "The time in this field must be equal to or a... The error text to display when the entered time is before #minValue. minText: "The time in this field must be equal to or a...
minValue Date/String - The minimum allowed time. Can be either a Javascript date object with a valid time value or a string time in a valid format – see #format and #altFormats. minValue: "示例值"
pickerMaxHeight Number 300 The maximum height of the Ext.picker.Time dropdown. pickerMaxHeight: 300
queryMode String 'local' 配置组件的 queryMode 选项。 queryMode: 'local'
selectOnTab Boolean true Whether the Tab key should select the currently highlighted item. selectOnTab: true
snapToIncrement Boolean false =false] Specify as true to enforce that only values on the #increment boundary are accepted. Typed values will be coerced to the nearest #increment point on blur. snapToIncrement: false
submitFormat String - =undefined] The date format string which will be submitted to the server. The format must be valid according to Ext.Date#parse. Defaults to #format. submitFormat: "示例值"
triggerCls String Ext.baseCSSPrefix + 'form-time-trigger' =‘x-form-time-trigger’] An additional CSS class used to style the trigger button. The trigger will always get the #triggerBaseCls by default and triggerCls will be appended if specified. triggerCls: Ext.baseCSSPrefix + 'form-time-trigger'
valueField String 'date' 下拉或选择组件作为实际值的记录字段。 valueField: 'date'

方法

方法 参数 说明 调用示例
initComponent `` 初始化组件及其子项。 执行时会保留父类默认行为、更新 storedisplayTpl 状态。源码涉及 setMinValue()setMaxValue()getPicker()formatDate() component.initComponent()
transformOriginalValue value 转换 originalValue。源码涉及 rawToValue() component.transformOriginalValue(...)
isEqual v1, v2 判断 equal 状态。 component.isEqual(...)
setMinValue value 设置 minValue。源码涉及 setLimit() component.setMinValue(...)
setMaxValue value 设置 maxValue。源码涉及 setLimit() component.setMaxValue(...)
setLimit value, isMin 设置 limit。源码涉及 parseDate()getInitDate() component.setLimit(...)
getInitDate hours, minutes, seconds, milliSec 读取并返回 initDate component.getInitDate(...)
valueToRaw value value 转换为 raw。源码涉及 formatDate()parseDate() component.valueToRaw(...)
getErrors value 读取并返回 errors。 执行时会保留父类默认行为。源码涉及 callParent()getRawValue()parseDate()formatDate() component.getErrors(...)
formatDate items 格式化 date component.formatDate(...)
parseDate value 解析 date。源码涉及 safeParse() component.parseDate(...)
safeParse value, format 处理 safeParse 操作。 component.safeParse(...)
getSubmitValue `` 读取并返回 submitValue。源码涉及 getValue() component.getSubmitValue()
createPicker `` 创建 picker。 执行时会保留父类默认行为、更新 listConfig 状态。源码涉及 callParent() component.createPicker()
onItemClick picker, record 处理 itemClick 回调。源码涉及 collapse() component.onItemClick(...)
syncSelection `` 同步 selection。源码涉及 getValue() component.syncSelection()
postBlur `` 执行后续处理 blur。 执行时会保留父类默认行为、更新组件值。源码涉及 getValue()callParent()validateValue()setValue() component.postBlur()
findRecordByValue value 查找 recordByValue。 执行时会保留父类默认行为。源码涉及 parseDate()callParent() component.findRecordByValue(...)
rawToValue item raw 转换为 value。源码涉及 parseDate() component.rawToValue(...)
setValue v 设置 value。 执行时会保留父类默认行为。源码涉及 getPicker()getInitDate()parseDate()callParent() component.setValue(...)
getValue `` 读取并返回 value。 执行时会保留父类默认行为。源码涉及 rawToValue()callParent() component.getValue()

事件

源码中未找到该组件自身注册的事件;可监听继承事件。

Navigation

Type to search…

↑↓ navigate↵ selectEsc close