---
title: "Ext.grid.column.Template"
description: "xtype 为 templatecolumn 的 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.grid.column.Template

源码定义：`ext-all-debug.js:123120`。分类：数据视图、表格与树。

## 创建示例

```javascript
var component = Ext.create("Ext.grid.column.Template", {
  xtype: "templatecolumn",
  renderer: { /* 配置 */ },
  scope: { /* 配置 */ },
  tpl: "示例值",
  renderTo: Ext.getBody()
});
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 配置示例 |
| --- | --- | --- | --- | --- |
| `renderer` | `Object` | `-` | 将原始数据转换为显示内容的渲染函数。 | `renderer: { /* 配置 */ }` |
| `scope` | `Object` | `-` | 处理函数执行时使用的作用域对象。 | `scope: { /* 配置 */ }` |
| `tpl` | `String/Ext.XTemplate` | `-` | An Ext.XTemplate, or an XTemplate *definition string* to use to process a Ext.data.Model's Ext.data.Model#persistenceProperty to produce a column's rendered value. | `tpl: "示例值"` |

## 方法

| 方法 | 参数 | 说明 | 调用示例 |
| --- | --- | --- | --- |
| `initComponent` | `` | 初始化组件及其子项。 执行时会保留父类默认行为、更新 `tpl`、`hasCustomRenderer` 状态。源码涉及 `callParent()`。 | `component.initComponent()` |
| `defaultRenderer` | `value, meta, record` | 生成 `default` 的渲染结果。 | `component.defaultRenderer(...)` |

## 事件

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

Source: https://ag.879818327.xyz/ext/data/grid-column-template/index.mdx
