1. #1
    Sencha User
    Join Date
    Jul 2012
    Location
    New Jersey
    Posts
    116
    Vote Rating
    5
    Answers
    6
    Mike6679 is on a distinguished road

      0  

    Default 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:

    Code:
      m_carousel.setIndicator(true);
    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?

  2. 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.

  3. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    148
    Vote Rating
    10
    Answers
    12
    pentool will become famous soon enough

      0  

    Default


    Try this:

    Code:
    m_carousel.getIndicator().setHidden(true/false);
    (Obviously, the carousel has to have an indicator on the first place in order this to work.)

  4. #3
    Sencha User
    Join Date
    Jul 2012
    Location
    New Jersey
    Posts
    116
    Vote Rating
    5
    Answers
    6
    Mike6679 is on a distinguished road

      0  

    Default


    didn't work. same result

  5. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    148
    Vote Rating
    10
    Answers
    12
    pentool will become famous soon enough

      0  

    Default


    Interesting. It's working for me. Not sure what might be the issue.

  6. #5
    Sencha User
    Join Date
    Jul 2012
    Location
    New Jersey
    Posts
    116
    Vote Rating
    5
    Answers
    6
    Mike6679 is on a distinguished road

      0  

    Default


    I'm setting the indicator visibility upon swiping so I'm wondering if their is some sort of conflict

  7. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    148
    Vote Rating
    10
    Answers
    12
    pentool will become famous soon enough

      0  

    Default


    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.

  8. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    148
    Vote Rating
    10
    Answers
    12
    pentool will become famous soon enough

      0  

    Default


    Sample:
    http://www.senchafiddle.com/#clHM6

    E
    very time you swipe, the indicators disappear. Swipe again, they re-appear. Swipe again, they disappear, etc.

  9. #8
    Sencha User
    Join Date
    Jul 2012
    Location
    New Jersey
    Posts
    116
    Vote Rating
    5
    Answers
    6
    Mike6679 is on a distinguished road

      0  

    Default


    thanks , that was it! too many hours of staring at sencha code I guess....

Thread Participants: 1

Tags for this Thread