带模板的显示字段
Displayfield with template
我正在尝试在显示字段中实现 tpl 以显示从文本区域发送到服务器的数据列表。
使用 rowexpander 插件在网格中显示相同的数据 ()
Fiddle: https://fiddle.sencha.com/#fiddle/14sf
我试过这样的事情:
FIDDLE: https://fiddle.sencha.com/#fiddle/14t7
没有成功...
我尝试了我发现的所有方法来渲染 tpl,但均未成功。
Display 有一个配置 tpl 但在我的情况下它似乎不起作用...
感谢解决此问题的建议
显示域也有渲染器功能。您可以在您的网格中使用它:
//var is just for illustration of the issue
var vegetables_types = 'potatos\ncarrots\npumpkins';
Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 450,
height: 200,
bodyPadding: 10,
title: 'Template',
items: [{
xtype: 'displayfield',
fieldLabel: 'TPL',
name: 'vegetables_types',
renderer: function(value, field) {
this.rndTpl = this.rndTpl || new Ext.XTemplate('<div><div>' + '<b>Vegetables: </b><ul><li>{[values.vegetables_types.replace(/\n/g, "<li/>")]}</li><ul>' + '</div></div>');
return this.rndTpl.apply({
vegetables_types: value
});
},
listeners: {
render: function(field, eOpts) {
field.setValue('potatos\ncarrots\npumpkins')
}
}
}],
});
我正在尝试在显示字段中实现 tpl 以显示从文本区域发送到服务器的数据列表。
使用 rowexpander 插件在网格中显示相同的数据 (
我试过这样的事情:
FIDDLE: https://fiddle.sencha.com/#fiddle/14t7 没有成功...
我尝试了我发现的所有方法来渲染 tpl,但均未成功。
Display 有一个配置 tpl 但在我的情况下它似乎不起作用...
感谢解决此问题的建议
显示域也有渲染器功能。您可以在您的网格中使用它:
//var is just for illustration of the issue
var vegetables_types = 'potatos\ncarrots\npumpkins';
Ext.create('Ext.form.Panel', {
renderTo: Ext.getBody(),
width: 450,
height: 200,
bodyPadding: 10,
title: 'Template',
items: [{
xtype: 'displayfield',
fieldLabel: 'TPL',
name: 'vegetables_types',
renderer: function(value, field) {
this.rndTpl = this.rndTpl || new Ext.XTemplate('<div><div>' + '<b>Vegetables: </b><ul><li>{[values.vegetables_types.replace(/\n/g, "<li/>")]}</li><ul>' + '</div></div>');
return this.rndTpl.apply({
vegetables_types: value
});
},
listeners: {
render: function(field, eOpts) {
field.setValue('potatos\ncarrots\npumpkins')
}
}
}],
});