是否可以在ExtJS模板中使用xtype ?

Is it possible to use an xtype inside an ExtJS template

本文关键字:xtype ExtJS 是否      更新时间:2023-09-26

我想知道我是否可以在ExtJS中做这样的事情。我正在创建我自己的按钮作为xtype,并希望它在我正在创建的表行中使用。

testTpl:  Ext.DomHelper.createTemplate(
    {
        tag: 'tbody',
        children: [
            {
                tag: 'tr',
                cls: 'test-row',
                children:[{
                    tag: 'td',
                    cls: 'test-table-cell test-class1',
                    html: '{value1}'
                    },
                    {
                       tag: 'td',
                       xtype:'myxtype'
                       cls: 'test-table-cell test-class2',
                       html: '{value2}'
                    }]
             }]
     });

不可能将ExtJS组件放在ExtJS模板中。虽然你可以做的是在你的模板中创建一个占位符,并在渲染函数中渲染ExtJS组件到那个占位符。

下面是一些带有示例的链接:

ExtJS 4.2.1 -添加textfield到XTemplate

Extjs中的Extjs组件