Hybrid View
-
10 Nov 2012 9:34 AM #1
Unanswered: itemswipe direction
Unanswered: itemswipe direction
Hi,
I saw that the swipe listener returns the direction of the swipe.
Now I am looking for the direction on the itemSwipe listener for the DataView.
Is there a better way to get the direction than to catch the itemTouchStart and item TouchEnd event.
Can I read the starting x - value from the itemSwipe?
Any idea?
-
12 Nov 2012 8:42 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
The direction should still be accessible in the itemswipe event on the event object argument.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Nov 2012 9:57 AM #3
This is the itemswipe event
Which one would show the diretion?
Code:event MouseEvent
- altKey: false
- bubbles: true
- button: 0
- cancelBubble: false
- cancelable: true
- changedTouches: Array[1]
- charCode: 0
- clientX: 300
- clientY: 204
- clipboardData: undefined
- ctrlKey: false
- currentTarget: #document
- dataTransfer: null
- defaultPrevented: false
- detail: 1
- eventPhase: 3
- fromElement: null
- identifier: 1
- keyCode: 0
- layerX: 300
- layerY: -29
- metaKey: false
- offsetX: 258
- offsetY: 49
- pageX: 300
- pageY: 204
- relatedTarget: null
- returnValue: true
- screenX: -1227
- screenY: 432
- shiftKey: false
- srcElement: <div>
- target: <div>
- targetTouches: Array[0]
- timeStamp: 1352742968502
- toElement: <div>
- touches: Array[0]
- type: "mouseup"
- view: Window
- webkitMovementX: 0
- webkitMovementY: 0
- which: 1
- x: 300
- y: 204
-
12 Nov 2012 10:29 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Something like this:
Code:Ext.Viewport.add({ xtype : 'list', itemTpl : '{test}', store : { fields : ['test'], data : [ { test : 'foo' } ] }, listeners : { itemswipe : function(list, index, item, record, event) { console.log(event.direction); } } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Nov 2012 1:27 AM #5
Interesting. But ....
It works what you are doing - inline:
but it does not like this. What am I doing wrong?Code:listeners : { itemswipe : function(list, index, item, record, event) { console.log(event.direction); } }
Code:listeners : { // Item-Swipe itemswipe : 'onItemSwipe' } }, onItemSwipe: function(list, index, item, record, event) { console.log(event.direction); }
-
13 Nov 2012 5:27 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
Still works for me:
Code:Ext.define('MyList', { extend : 'Ext.dataview.List', xtype : 'mylist', config : { itemTpl : '{test}', listeners : { itemswipe : 'onMyItemSwipe' } }, onMyItemSwipe : function(list, index, item, record, event) { console.log(event.direction); } }); Ext.application({ name : 'Test', launch : function () { Ext.Viewport.add({ xtype : 'mylist', store : { fields : ['test'], data : [ { test : 'foo' } ] } }); } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote