Plugins 如何在rowexpander插件中使用模板-ExtJS4
我们可以使用以下模板:Plugins 如何在rowexpander插件中使用模板-ExtJS4,plugins,extjs,extjs4,extjs4.1,Plugins,Extjs,Extjs4,Extjs4.1,我们可以使用以下模板: plugins: [{ ptype: 'rowexpander', selectRowOnExpand : false, rowBodyTpl: new Ext.XTemplate( '<p>Qusetions: {question}</p><p>', '<tpl for="o
plugins: [{
ptype: 'rowexpander',
selectRowOnExpand : false,
rowBodyTpl: new Ext.XTemplate(
'<p>Qusetions: {question}</p><p>',
'<tpl for="option">',
'<p>{option[0]}</p>',
'</tpl></p>'
)
}]
+ Questions: What is your fav color
<radiobutton> Red
<radiobutton> Green
<radiobutton> Blue
模型文件
Ext.define('AM.model.Question', {
extend: 'Ext.data.Model',
fields: [
{name: 'question'},
{name: 'option'},
{name: 'images'},
{name: 'qno'}
]});
我希望看到如下输出:
plugins: [{
ptype: 'rowexpander',
selectRowOnExpand : false,
rowBodyTpl: new Ext.XTemplate(
'<p>Qusetions: {question}</p><p>',
'<tpl for="option">',
'<p>{option[0]}</p>',
'</tpl></p>'
)
}]
+ Questions: What is your fav color
<radiobutton> Red
<radiobutton> Green
<radiobutton> Blue
+问题:你最喜欢什么颜色
红色
绿色
蓝色
我正在使用ExtJS4.1版本
提前感谢您的回答当使用XTemplate遍历数组时,使用
{.}
引用当前项。您的模板应如下所示:
'<p>Questions: {question}</p>',
'<p>',
'<tpl for="option">',
'<p>{.}</p>',
'</tpl>',
'</p>'
'<tpl for="option">',
'<input type="radio" name="qno_{parent.qno}" value="{.}" />{.}<br/>'
'</tpl>'