javascript - Sencha Touch 2 error: Cannot read property 'apply' of undefined -
i have following sencha touch code. simple list view.
{ xtype: 'list', itemid: 'stockitemslist', ui: 'normal', flex: 1, onitemdisclosure: false, preventselectionondisclose: false, itemtpl: '<div class="act-list">'+ '<table width="100%">'+ '<tr>'+ '<td width="10%"><img align="left" src="img/icon_check2.png"/></td>'+ '<td width="80%"><b> {materialdesc}</b></td>'+ //'<td width="10%" ><img align="right" src="img/icon_list_disclosure.png"/></td>'+ '</tr>'+ '</table>'+ '</div>' }
i want set alert once click item of list view. in controller tried following.
ext.define('net.omobio.dialog.dialogcc.controller.stockavailability', { extend: 'ext.app.controller', /*requires: [ 'net.omobio.dialog.dialogcc.store.stockitems'],*/ config: { refs: { maincard: 'stockitemsmain #cardview', stockitems: 'stock_items', stockitemlist: 'stock_items #stockitemslist' }, control: { 'stockitemlist': { itemtap: 'onstockitemlisttap' } }, routes: { 'bucketlist': 'loadbucketlist' }, onstockitemlisttap: function(list, index, target, record, event) { console.log('item tapped on data view'); console.log(list, index, target, record, event); ext.msg.alert('', 'the material code selected is: ' + record.get('materialcode')); var me = this; console.log('record'); console.log(record); console.log('index'); console.log(index); }, loadbucketlist: function() { console.log('xxxx bucket list'); //this.showview('docrecoverydsr.connectionlist'); } } });
but once click item gives following error.
uncaught typeerror: cannot read property 'apply' of undefined
any suggestions appreciated.
please try below code
ext.define('net.omobio.dialog.dialogcc.controller.stockavailability', { extend: 'ext.app.controller', /*requires: [ 'net.omobio.dialog.dialogcc.store.stockitems'],*/ config: { refs: { maincard: 'stockitemsmain #cardview', stockitems: 'stock_items', stockitemlist: 'stock_items #stockitemslist' }, control: { stockitemlist: { itemtap: 'onstockitemlisttap' } }, routes: { 'bucketlist': 'loadbucketlist' } }, onstockitemlisttap: function(list, index, target, record, event) { console.log('item tapped on data view'); console.log(list, index, target, record, event); ext.msg.alert('', 'the material code selected is: ' + record.get('materialcode')); var me = this; console.log('record'); console.log(record); console.log('index'); console.log(index); }, loadbucketlist: function() { console.log('xxxx bucket list'); //this.showview('docrecoverydsr.connectionlist'); } });