PDA

View Full Version : [CLOSED] tapping the list once, itemtap event appear twice. (in 0.99)



fermina
7 Nov 2010, 8:50 PM
Hi.

I have a question.

After upgrading to version 0..99, tapping the list once, itemtap event appear twice.

Sample attached. Please check out this.


<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
<link rel="stylesheet" href="../../resources/css/sencha-touch.css" type="text/css">
<script type="text/javascript" src="../../sencha-touch-debug.js"></script>
<script type="text/javascript">
Ext.ns('test');

Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});

test.MyList = Ext.extend(Ext.List, {
title: 'my list',
singleSelect: true,
itemTpl: '<div class="Contact">{firstName} {lastName}</div>',
store: new Ext.data.Store({
model: 'Contact',
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Ed', lastName: 'Spencer'}
]
}),

initComponent: function() {
this.addEvents('itemSelect'); //?

this.on('itemtap', this.onItemTap, this);

test.MyList.superclass.initComponent.call(this);
},

onItemTap: function (list, index, item, e) {
alert('MyList onItemTap');
console.log('[MyList onItemTap] ' + list.title + ' - ' + index);
this.fireEvent('itemSelect', list, index, item, e); //?
}
});

test.MainPanel = Ext.extend(Ext.Carousel, {
fullscreen: true,
defaults: {
cls: 'card'
},
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
title: 'Title - docked in Carousel'
}],

initComponent: function() {

var subPanel = new test.MyList({
listeners: {
scope: this,
itemSelect: this.onItemSelect ////?
}
});

this.items = [subPanel];

test.MainPanel.superclass.initComponent.call(this);
},

onItemSelect: function(list, index, item, e) {
console.log('[MainPanel onItemSelect] ' + list.title + ' - ' + index);
}
});

Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,

onReady: function(){
mainPanel = new test.MainPanel();
}
});
</script>
</head>
<body>
</body>
</html>

aconran
8 Nov 2010, 10:31 AM
onItemTap is a private method within List. You will need to rename your onItemTap method to something else and this will start working again as you expect it to.

fermina
8 Nov 2010, 4:13 PM
Thank you for reply.
It works fine.