-
20 Feb 2012 9:52 AM #1
Unanswered: Scrolling to list item problem(s)!
Unanswered: Scrolling to list item problem(s)!
Hi again,
I am (still) trying to get my scroller to scroll to the selected target on itemTap event.
I'm doing this:
But I always get:Code:onListItemTap: function(dataview, index, target, record, e, options) { var scroller = dataview.getScrollable().getScroller(); var offsets = target.getOffsetsTo(scroller); scroller.scrollTo(0,target[1],true); }
I don't get what I'm doing wrong. I managed to get it working by passing the target.dom.offsetTop, but I don't feel that this is the right way of doing this.Code:Cannot read property 'x' of null
Also, how do I get the scrollTo to animate properly, I think I have to pass an animation object to it, but I just don't know how to create this animation object.
Thanks!
-
20 Feb 2012 10:13 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3106
scrollTo takes 3 arguments, the x, y and animation.
Does target[1] equal the y value you want to scroll to?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.
-
20 Feb 2012 11:45 AM #3
It was my mistake when I copied the code here, it should read offsets[1] instead of target[1]. But the problem isn't in the scrollTo, as I said, I found a (dirty) workaround which works perfectly, but I wanted to do this the right way. The problem is in the getOffsetsTo, which always returns me that error no matter what component I send to it...
About the animation part, I tried:
but still got no results...Code:new Ext.Anim({ duration:1000 })
Please help


Reply With Quote