是否可以在ExtJS模板中使用xtype [英] Is it possible to use an xtype inside an ExtJS template

查看:127
本文介绍了是否可以在ExtJS模板中使用xtype的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  testTpl:Ext .DomHelper.createTemplate(
{
标签:'tbody',
children:[
{
标签:'tr',
cls:'test 'b




$ b标签:'td',
cls:'test-table-cell test-class1',
html:'{value1}
},
{
标签:'td',
xtype:'myxtype'
cls:'test-table-cell test-class2',
html:'{value2}'
}]
}]
});


解决方案

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



这里是一些例子的链接:



ExtJS 4.2 .1 - 将文本框添加到XTemplate



ExtTXT中的Extjs组件在EXTJS 4上


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

这篇关于是否可以在ExtJS模板中使用xtype的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆