简体   繁体   中英

Is it possible to use an xtype inside an ExtJS template

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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