Skip to content

Ext.form.field.Date

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

Updated View as Markdown

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

创建示例

var component = Ext.create("Ext.form.field.Date", {
  xtype: "datefield",
  altFormats: "Y-m-d|y-m-d|Y-n-j|y-n-j|Y-m-j|y-m-j|Y-n-d|y-...,
  disabledDatesText: "Disabled",
  disabledDaysText: "Disabled",
  format: "m/d/Y",
  renderTo: Ext.getBody()
});

属性

属性 类型 默认值 说明 配置示例
altFormats String "Y-m-d|y-m-d|Y-n-j|y-n-j|Y-m-j|y-m-j|Y-n-d|y-... 配置组件的 altFormats 选项。 altFormats: "Y-m-d|y-m-d|Y-n-j|y-n-j|Y-m-j|y-m-j|Y-n-d|y-...
disabledDatesText String "Disabled" 配置组件的 disabledDatesText 选项。 disabledDatesText: "Disabled"
disabledDaysText String "Disabled" 配置组件的 disabledDaysText 选项。 disabledDaysText: "Disabled"
format String "m/d/Y" 值显示与解析时使用的格式。 format: "m/d/Y"
initTime String '12' 配置组件的 initTime 选项。 initTime: '12'
initTimeFormat String 'H' 配置组件的 initTimeFormat 选项。 initTimeFormat: 'H'
invalidText String "{0} is not a valid date - it must be in the ... 配置组件的 invalidText 选项。 invalidText: "{0} is not a valid date - it must be in the ...
labelSeparator String '' 配置组件的 labelSeparator 选项。 labelSeparator: ''
matchFieldWidth Boolean false 控制是否启用 matchFieldWidth 行为。 matchFieldWidth: false
maxText String "The date in this field must be equal to or b... 配置 maxText 限制值。 maxText: "The date in this field must be equal to or b...
minText String "The date in this field must be equal to or a... 配置 minText 限制值。 minText: "The date in this field must be equal to or a...
showToday Boolean true 控制是否显示 today showToday: true
startDay Number 0 配置组件的 startDay 选项。 startDay: 0
triggerCls Mixed Ext.baseCSSPrefix + 'form-date-trigger' 配置 triggerCls 对应的 CSS 类名。 triggerCls: Ext.baseCSSPrefix + 'form-date-trigger'
useStrict Mixed undefined 配置组件的 useStrict 选项。 useStrict: undefined

方法

方法 参数 说明 调用示例
initComponent `` 初始化组件及其子项。 执行时会保留父类默认行为、更新 minValuemaxValue 状态。源码涉及 parseDate()initDisabledDays()callParent() component.initComponent()
initValue `` 初始化 value。 执行时会保留父类默认行为、更新 value 状态。源码涉及 rawToValue()callParent() component.initValue()
getValue `` 读取并返回 value。 执行时会保留父类默认行为、更新 stringDateValue 状态。源码涉及 callParent() component.getValue()
initDisabledDays `` 初始化 disabledDays。 执行时会更新 disabledDatesRE 状态。 component.initDisabledDays()
setDisabledDates dd 设置 disabledDates。 执行时会更新 disabledDates 状态。源码涉及 initDisabledDays() component.setDisabledDates(...)
setDisabledDays dd 设置 disabledDays。 执行时会更新 disabledDays 状态。 component.setDisabledDays(...)
setMinValue dt 设置 minValue。 执行时会更新 minValue 状态。源码涉及 parseDate()formatDate() component.setMinValue(...)
setMaxValue dt 设置 maxValue。 执行时会更新 maxValue 状态。源码涉及 parseDate()formatDate() component.setMaxValue(...)
getErrors value 读取并返回 errors。 执行时会保留父类默认行为。源码涉及 callParent()formatDate()processRawValue()getRawValue() component.getErrors(...)
rawToValue rawValue raw 转换为 value。源码涉及 parseDate() component.rawToValue(...)
valueToRaw value value 转换为 raw。源码涉及 formatDate()parseDate() component.valueToRaw(...)
safeParse value, format 处理 safeParse 操作。 component.safeParse(...)
getSubmitValue `` 读取并返回 submitValue。源码涉及 getValue() component.getSubmitValue()
parseDate value 解析 date。源码涉及 safeParse() component.parseDate(...)
formatDate date 格式化 date component.formatDate(...)
createPicker `` 创建 picker。源码涉及 formatDate()collapse()focus() component.createPicker()
onDownArrow e 处理 downArrow 回调。 执行时会保留父类默认行为。源码涉及 callParent()getPicker() component.onDownArrow(...)
onSelect m, d 处理 select 回调。 执行时会派发 select 事件、更新组件值。源码涉及 setValue()fireEvent()collapse()focus() component.onSelect(...)
onExpand `` 处理 expand 回调。源码涉及 getValue() component.onExpand()
beforeBlur `` blur 前执行预处理。 执行时会更新组件值。源码涉及 rawToValue()getRawValue()setValue() component.beforeBlur()

事件

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

Navigation

Type to search…

↑↓ navigate↵ selectEsc close