---
title: "Ext.form.field.DatetimeDetail"
description: "xtype 为 datetimedetailfield 的 Ext JS 原生组件参考。"
---

> Documentation Index
> Fetch the complete documentation index at: https://ag.879818327.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Ext.form.field.DatetimeDetail

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

## 创建示例

```javascript
var component = Ext.create("Ext.form.field.DatetimeDetail", {
  xtype: "datetimedetailfield",
  combineErrors: true,
  layout: 'hbox',
  width: 200,
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `combineErrors` | `Boolean` | `true` | 控制是否启用 `combineErrors` 行为。 | `combineErrors: true` |
| `layout` | `String` | `'hbox'` | 容器对子组件进行排布的布局配置。 | `layout: 'hbox'` |
| `width` | `Number` | `200` | 组件宽度。 | `width: 200` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `initComponent` | `` | 初始化组件及其子项。 执行时会保留父类默认行为、更新 `dateField`、`timeField` 状态。源码涉及 `buildField()`、`callParent()`、`down()`、`addEvents()`。 | `component.initComponent()` |
| `initEvents` | `` | 初始化 `events`。 执行时会保留父类默认行为。源码涉及 `mon()`、`callParent()`。 | `component.initEvents()` |
| `focus` | `` | 将焦点移动到组件。 | `component.focus()` |
| `onFocus` | `field, e, options` | 处理 `focus` 回调。 执行时会派发 `focus` 事件。源码涉及 `fireEvent()`。 | `component.onFocus(...)` |
| `onBlur` | `field, e, options` | 处理 `blur` 回调。 执行时会派发 `blur` 事件。源码涉及 `fireEvent()`。 | `component.onBlur(...)` |
| `onSpecialKey` | `field, e, options` | 处理 `specialKey` 回调。 执行时会派发 `specialkey` 事件。源码涉及 `fireEvent()`。 | `component.onSpecialKey(...)` |
| `onChange` | `field, newValue, oldValue, options` | 处理 `change` 回调。 执行时会派发 `change` 事件。源码涉及 `fireEvent()`、`getValue()`、`joinValue()`。 | `component.onChange(...)` |
| `doMethod` | `method` | 执行 `method` 操作。 | `component.doMethod(...)` |
| `reset` | `` | 将组件恢复为初始状态。源码涉及 `doMethod()`。 | `component.reset()` |
| `validate` | `` | 校验当前组件。 | `component.validate()` |
| `clearInvalid` | `` | 清空 `invalid`。源码涉及 `doMethod()`。 | `component.clearInvalid()` |
| `isValid` | `` | 判断 `valid` 状态。 | `component.isValid()` |
| `resetOriginalValue` | `` | 重置 `originalValue`。源码涉及 `doMethod()`。 | `component.resetOriginalValue()` |
| `buildField` | `` | 构建 `field`。 执行时会更新 `items` 状态。 | `component.buildField()` |
| `getValue` | `` | 读取并返回 `value`。源码涉及 `joinValue()`。 | `component.getValue()` |
| `getRawValue` | `` | 读取并返回 `rawValue`。 | `component.getRawValue()` |
| `setRawValue` | `value` | 设置 `rawValue`。 | `component.setRawValue(...)` |
| `joinValue` | `date, time` | 组合 `value`。 | `component.joinValue(...)` |
| `setValue` | `value` | 设置 `value`。 | `component.setValue(...)` |

## 事件

| 事件 | 说明 | 监听示例 |
| --- | --- | --- |
| `blur` | 组件失去焦点时触发。 源码在 `onBlur()` 中通过 `fireEvent()` 触发。 | `listeners: { blur: function () {} }` |
| `change` | 组件值发生变化时触发。 源码在 `onChange()` 中通过 `fireEvent()` 触发。 | `listeners: { change: function () {} }` |
| `focus` | 组件获得焦点时触发。 源码在 `onFocus()` 中通过 `fireEvent()` 触发。 | `listeners: { focus: function () {} }` |
| `specialkey` | 组件获得特殊按键输入时触发。 源码在 `onSpecialKey()` 中通过 `fireEvent()` 触发。 | `listeners: { specialkey: function () {} }` |

Source: https://ag.879818327.xyz/ext/form/form-field-datetimedetail/index.mdx
