-
2 Aug 2012 1:19 PM #1
Answered: Carousel setIndicator(true) dynamically not working
Answered: Carousel setIndicator(true) dynamically not working
I call setIndicator(false) in initialize() in my custom Carousel class. This works and it does not show the carousel indicator dots when my app comes up. I have a controller in which I pass a reference to my carousel. In this controller I handle various carousel events such as onDragEnd etc. In my controller I also handle showing the indicator dots dynamically. I call:
however the indicator dots do not appear. Is there some layout function I have to call to redraw the carousel to show my dots or something?Code:m_carousel.setIndicator(true);
-
Best Answer Posted by pentool
Oh, I think I know why. Don't set your indicator to false in the initialize function. Just let it have an indicator. Instead, just use the setHidden(true/false) on the indicator itself.
If you do a setIndicator(false), then you don't have an indicator. If you setIndicator(false) and then you do a getIndicator() - just for testing - you won't get an object back. You will get "false" as a return result. Therefore, once you did a setIndicator(false), you cannot do a getIndicator().setIndicator(true) on it.
-
2 Aug 2012 2:33 PM #2
Try this:
(Obviously, the carousel has to have an indicator on the first place in order this to work.)Code:m_carousel.getIndicator().setHidden(true/false);
-
2 Aug 2012 3:17 PM #3
didn't work. same result
-
2 Aug 2012 3:39 PM #4
Interesting. It's working for me. Not sure what might be the issue.
-
2 Aug 2012 3:44 PM #5
I'm setting the indicator visibility upon swiping so I'm wondering if their is some sort of conflict
-
2 Aug 2012 3:51 PM #6
Oh, I think I know why. Don't set your indicator to false in the initialize function. Just let it have an indicator. Instead, just use the setHidden(true/false) on the indicator itself.
If you do a setIndicator(false), then you don't have an indicator. If you setIndicator(false) and then you do a getIndicator() - just for testing - you won't get an object back. You will get "false" as a return result. Therefore, once you did a setIndicator(false), you cannot do a getIndicator().setIndicator(true) on it.
-
2 Aug 2012 4:12 PM #7
Sample:
http://www.senchafiddle.com/#clHM6
Every time you swipe, the indicators disappear. Swipe again, they re-appear. Swipe again, they disappear, etc.
-
2 Aug 2012 4:29 PM #8
thanks , that was it! too many hours of staring at sencha code I guess....


Reply With Quote