View Full Version : XTemplate with subtemplates

29 Jan 2015, 4:57 AM
Can you help me with an example. I use MVC paradigm and have some troubles with defining component.

How can I access to the subtemplate and custom method inside template?

Ext.define('app.view.MyView', {
extend: 'Ext.view.View',
alias: 'widget.MyView',
store: 'app.store.MyStore',
autoScroll: true,
tpl: [
'<tpl for=".">',
'<div class="main">',
'<div class="{room}">',
'[{%testTpl.apply(values)%}]', // Error: testTpl is not defined
'[{%customMethod(args)%}]', //not defined
testTpl: [
itemSelector: 'div.main',
initComponent: function() {
var me = this;
customMethod: function(args){
//some code here

29 Jan 2015, 11:18 AM
I think that you need some this' in there, and that your actual method will get mapped as 'doCustomMethod'... I think. I may be completely wrong and that is based off of reading the code for various components.

29 Jan 2015, 11:32 AM
You are wrong. 'this' inside tpl refer to this template.