-
29 Mar 2012 10:10 AM #1
infinite carousel scrolls past end of items to empty page
infinite carousel scrolls past end of items to empty page
I'm trying to debug an issue with the infinite carousel where it will scroll past the end of the list of items in the data store and display empty pages if you continue to scroll to the right. In other words, if you swipe through the pages and get to the end of the available records, it displays empty content and does not snap back like you'd expect to signal to the user you're at the end of the list.
I've adapted my app from the TouchStyle demo which loads data into the store via jsonp. The activeItemChange and itemIndexChange events are being handled in app/view/ProductsList.js. From what I can tell by setting debug break points in these event handlers, everything is working properly and being loaded into the store. I just don't know how to signal the carousel that it has hit the end of the list of products and should not continue to scroll to the right and display empty content.
You can see this behavior in the TouchStyle demo app if you're patient enough to scroll all the way to the end of a list of products. I did this on an iPad where it was displaying 8 products on a page. It took a while, but when you get to the last page and swipe one more page past the end, you'll see a completely empty/white page.
Any ideas or feedback on how to fix this would be greatly appreciated.
Thanks!
-
29 Mar 2012 10:34 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 435
The infinite carousel is marked as private which is recommended you don't rely on it. I'm still going to open a ticket for this as we are using it.
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.
-
29 Mar 2012 1:02 PM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
As Mitchell alluded to, the infinite carousel isn't quite ready for primetime. We plan to have fully supported infinite Carousels and Lists in 2.1.
-
29 Mar 2012 2:48 PM #4
Thanks for the replies and letting me know when to expect it to be updated.
In my app, I don't expect to have that many items in the store... like maybe 20 - 30 at the most.
I could just switch to a normal carousel given that number of items? Just trying to think of a workaround to use in the meantime.
Thanks again!
-
29 Mar 2012 8:17 PM #5Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,652
- Vote Rating
- 14
We'll take a look.
-
29 Mar 2012 8:49 PM #6
Hi,
If you do a setMaxItemIndex() on the carousel, that will set the number of slides.
Remember to define your count inside your instance of the infinite carousel. I'm sure you are doing that or it would be breaking. Also a word of caution it looks like the current implementation shows count + 1 so if you don't catch that you will be losing some of your items or seeing the last item of panel 1 as the first item on panel 2
Something like that, works for me.Code:Var storeCount = store.data.length; Var count = store.getCount(); Var maxPanels = parseInt(storeCount/count,10) // plus logic for the remainder This.getNameOfPanel().setMaxItemIndex(maxPanels)
-
30 Mar 2012 12:03 AM #7Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
If you know the number of items up-front, set the 'maxItemIndex' config value (default is Infinity), for example:
Note that the value is index, not count, so if you have 10 items, the max index is 9.Code:Ext.define('My.view.InfiniteCarousel', { extend: 'Ext.carousel.Infinite', config: { maxItemIndex: 123 // ... } // ... });
You can also programmatically set 'maxItemIndex' at any given time later if the value is not known beforehand. A common use case is calling the setter inside the 'itemindexchange' listener:
Code:Ext.define('My.view.InfiniteCarousel', { extend: 'Ext.carousel.Infinite', config: { // ... listeners: { itemindexchange: 'onItemIndexChange' // ... } }, onItemIndexChange: function(me, item, index) { // ... if (thisIsTheLastIndex) { this.setMaxItemIndex(index); } // ... } });Sencha Touch Lead Architect
-
15 Oct 2012 3:48 AM #8
Looks like we cannot reproduce this. Please provide another test case to reproduce this issue.


Reply With Quote