Is it possible to use an xtype inside an ExtJS template

て烟熏妆下的殇ゞ 提交于 2019-12-13 00:45:14

问题


I am wondering if I can do something like this in ExtJS. I am creating my own button as an xtype and want it to be used in the table row I am creating.

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}'
                    }]
             }]
     });

回答1:


Its not possible to place ExtJS components inside of a extjs template. Though what you could do is to create a placeholder in your template and render ExtJS components into that placeholder in the render function.

Here are some links with examples:

ExtJS 4.2.1 - add textfield to an XTemplate

Extjs component inside Ext.XTemplate on EXTJS 4



来源:https://stackoverflow.com/questions/25292024/is-it-possible-to-use-an-xtype-inside-an-extjs-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!