1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    8
    Vote Rating
    0
    paltinescu is on a distinguished road

      0  

    Default Answered: Toggle carousel indicator

    Answered: Toggle carousel indicator


    Hi,

    Is there a way to toggle a carousel's indicator at runtime (so, to set its indicator property to true or false, once it's loaded in page)?

    Thanks!

  2. The setter will destroy the old indicator and create a new one which works but is not optimal. You can just hide the one that is created:

    Code:
    carousel.getIndicator().hide();
    carousel.getIndicator().show();

  3. #2
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Answers
    64
    Vote Rating
    20
    haduki will become famous soon enough haduki will become famous soon enough

      0  

    Default


    Code:
    carousel.setIndicator({hidden:true})//hide the indicator
    carousel.setIndicator({hidden:false})//show the indicator
    I write English by translator.

  4. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    8
    Vote Rating
    0
    paltinescu is on a distinguished road

      0  

    Default


    Somehow I keep forgetting that configuration options are set using the setConfigName() methods... Thanks!

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The setter will destroy the old indicator and create a new one which works but is not optimal. You can just hide the one that is created:

    Code:
    carousel.getIndicator().hide();
    carousel.getIndicator().show();
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    8
    Vote Rating
    0
    paltinescu is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    The setter will destroy the old indicator and create a new one which works but is not optimal. You can just hide the one that is created:

    Code:
    carousel.getIndicator().hide();
    carousel.getIndicator().show();
    Great tip! One question, though: could an existing (hidden or not) carousel indicator be updated automatically by adding (or removing) elements from the carousel?

  7. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you add/remove components to the carousel the indicator will stay in sync with that yes.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.