So I have a template being populated with data from an ajax request. My goal is to let an item in that template be tappable.
my thought was to simply give the button a unique id or class (preferably class as there may be many) then use the refs and controls in the controller to specify a handle for the tap action.
I can't seem to get this working through. Is this not how it works?
example:
Code:
Ext.define('STMobile.controller.Cases', {
extend: 'Ext.app.Controller',
requires: ['Ext.data.Store'],
config: {
refs: {
casesList: 'casesindex',
testRef: '#doctorbutton'
},
control: {
casesList: {
itemtap: 'onCaseTap',
activate: 'onCaseIndexActivate'
},
testRef: {
tap: 'showTest'
}
},
},
showTest: function(){
console.log('test tapped');
},
onCaseTap: function() {
// omitted for clarity but this function loads uses the getCaseTPL function and pushes the new view
},
getCaseTpl: function() {
return new Ext.XTemplate([
'<tpl for=".">',
'<div class="case">',
'<div class="">{date:date("M d, Y")}</div>',
'<div class="">{name}</div>',
'</div>',
'<tpl for="testinfo">',
'<div id="test">',
'<div class=""><a href="#" id="testbutton">{name}</a></div>',
'<div class="">{email}</div>',
'</div>',
'</tpl>',
'</tpl>'
].join(''));
},