PDA

View Full Version : weird params provided by itemtap event on Ext.dataview.List



ThiemNguyen
20 Nov 2013, 8:59 AM
Hi everyone,

This is a very common method which is widely used:


onItemtap: function(dataview, index, target, record, e, eOpts)


I have just written a simple action method with some logging logics:


onItemTap: function(dataview, index, target, record, e, eOpts){
console.log(dataview);
console.log(index);
console.log(target);
console.log(record));
console.log(e);
},


And here is what I saw in the Chrome console.

Object {options: Array[2]}

Class {changedTouches: Array[1], touches: Array[0], targetTouches: Array[0], pageX:327, pageY: 116…}

<div class=?"x-innerhtml" id=?"ext-element-81">?Here is the second session?</div>?

Object {delegate: ".x-list-item"}

Class {firingListeners: Array[1], firingArguments: Array[4], info: Object,listenerStacks: Array[1], isPausing: false…}

undefined

The order and values of params (as per documented in the documentation) seems to be broken.
And also the code gets crashed when I tried using "record.get()" to fetch a field value.
Any idea please? Thanks.

ThiemNguyen
21 Nov 2013, 10:15 PM
I have just found out why.onItemTap is a predefined function in the framework itself, changing its name should work...

fmoseley
22 Nov 2013, 2:25 PM
Did you name your listening method "onItemTap"?
Ext.dataview.DataView already has a "onItemTap: function(container, target, index, e)" which fires the "onitemtap" event and is inherited by Ext.dataview.List.
Therefore you would get the wrong params and prevent the onItemTap event from being fired.

Posting the comment docs here in case someone else runs into this issue.

ThiemNguyen
25 Nov 2013, 12:15 AM
Thank you fmoseley (http://www.sencha.com/forum/member.php?332086-fmoseley) for the help!

Ant0nin
30 Jan 2014, 7:23 AM
Did you name your listening method "onItemTap"?
Ext.dataview.DataView already has a "onItemTap: function(container, target, index, e)" which fires the "onitemtap" event and is inherited by Ext.dataview.List.
Therefore you would get the wrong params and prevent the onItemTap event from being fired.

Posting the comment docs here in case someone else runs into this issue.

Same problem for me. Thanks a lot !