---
title: "Ext.form.Panel"
description: "xtype 为 form 的 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.Panel

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

## 创建示例

```javascript
var component = Ext.create("Ext.form.Panel", {
  xtype: "form",
  ariaRole: 'form',
  basicFormConfigs: [,
  layout: 'anchor',
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `ariaRole` | `String` | `'form'` | 组件在辅助技术中的 ARIA 角色。 | `ariaRole: 'form'` |
| `basicFormConfigs` | `Array` | `[` | 配置组件的 `basicFormConfigs` 选项。 | `basicFormConfigs: [` |
| `layout` | `String` | `'anchor'` | 容器对子组件进行排布的布局配置。 | `layout: 'anchor'` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `initComponent` | `` | 初始化组件及其子项。 执行时会保留父类默认行为、更新 `border` 状态。源码涉及 `initFieldAncestor()`、`callParent()`、`relayEvents()`、`startPolling()`。 | `component.initComponent()` |
| `initItems` | `` | 初始化 `items`。 执行时会保留父类默认行为、更新 `form` 状态。源码涉及 `callParent()`、`initMonitor()`、`createForm()`。 | `component.initItems()` |
| `afterFirstLayout` | `` | 在 `firstLayout` 后执行后处理。 执行时会保留父类默认行为。源码涉及 `callParent()`。 | `component.afterFirstLayout()` |
| `createForm` | `` | 创建 `form`。 | `component.createForm()` |
| `getForm` | `` | 读取并返回 `form`。 | `component.getForm()` |
| `loadRecord` | `record` | 加载 `record`。源码涉及 `getForm()`。 | `component.loadRecord(...)` |
| `getRecord` | `` | 读取并返回 `record`。源码涉及 `getForm()`。 | `component.getRecord()` |
| `updateRecord` | `record` | 更新 `record`。源码涉及 `getForm()`。 | `component.updateRecord(...)` |
| `getValues` | `asString, dirtyOnly, includeEmptyText, useDataValues` | 读取并返回 `values`。源码涉及 `getForm()`。 | `component.getValues(...)` |
| `isDirty` | `` | 判断 `dirty` 状态。 | `component.isDirty()` |
| `isValid` | `` | 判断 `valid` 状态。 | `component.isValid()` |
| `hasInvalidField` | `` | 检查是否存在 `invalidField`。 | `component.hasInvalidField()` |
| `beforeDestroy` | `` | 在 `destroy` 前执行预处理。 执行时会保留父类默认行为。源码涉及 `stopPolling()`、`callParent()`。 | `component.beforeDestroy()` |
| `load` | `options` | 处理 `load` 操作。 | `component.load(...)` |
| `submit` | `options` | 提交当前组件。 | `component.submit(...)` |
| `startPolling` | `interval` | 开始 `polling`。 执行时会更新 `pollTask` 状态。源码涉及 `stopPolling()`。 | `component.startPolling(...)` |
| `stopPolling` | `` | 停止 `polling`。 | `component.stopPolling()` |
| `checkChange` | `` | 处理 `checkChange` 操作。 | `component.checkChange()` |

## 事件

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

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