简体   繁体   English

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

[英]Is it possible to use an xtype inside an ExtJS template

I am wondering if I can do something like this in ExtJS. 我想知道是否可以在ExtJS中执行类似的操作。 I am creating my own button as an xtype and want it to be used in the table row I am creating. 我正在将自己的按钮创建为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}'
                    }]
             }]
     });

Its not possible to place ExtJS components inside of a extjs template. 无法将ExtJS组件放置在extjs模板中。 Though what you could do is to create a placeholder in your template and render ExtJS components into that placeholder in the render function. 尽管您可以做的是在模板中创建一个占位符,然后将ExtJS组件渲染到render函数中的该占位符中。

Here are some links with examples: 以下是一些示例链接:

ExtJS 4.2.1 - add textfield to an XTemplate ExtJS 4.2.1-将文本字段添加到XTemplate

Extjs component inside Ext.XTemplate on EXTJS 4 EXTJS 4上Ext.XTemplate内的Extjs组件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM