Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    86
    Vote Rating
    -7
    CarClub is on a distinguished road

      0  

    Default Carousel getActiveItem returns NULL

    Carousel was just created with a single item containing some html text. Calling getActiveItem returns NULL. Seems like it should return the item it is displaying.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,555
    Vote Rating
    1121
    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

    Using 2.0.0, 2.0.1 and 2.0.1.1 it is returning the instance for me:

    Code:
    var carousel = new Ext.carousel.Carousel({
        fullscreen : true,
        items      : [
            {
                html : 'foo'
            }
        ]
    });
    
    console.log(carousel.getActiveItem());
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    86
    Vote Rating
    -7
    CarClub is on a distinguished road

      0  

    Default

    Too fast on the draw there.
    This fails.

    Code:
    var carousel = new Ext.carousel.Carousel({   fullscreen : true,
       items: [{
            xtype: 'label',
            html: 'No Images',
        centered: true }]
       
    });
    
    
    
    
    
    
    console.log("Active Item: " + carousel.getActiveItem());
    
    produces Active Item: undefined

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,555
    Vote Rating
    1121
    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

    That's because the centered config makes that item floating and therefor not an inner item. Only inner items can be active therefore getActiveItem will return null.

    If you do this it will work:

    Code:
    var carousel = new Ext.carousel.Carousel({   
        fullscreen : true,
        items      : [
            {
                xtype : 'label',
                html  : 'No Images'
            }
        ]
    
    });
    
    console.log('Active Item: ' + carousel.getActiveItem());
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  5. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    86
    Vote Rating
    -7
    CarClub is on a distinguished road

      0  

    Default

    That is a pretty bizarre constraint. There are no warnings in the docs about this sort of thing at all.

  6. #6
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,555
    Vote Rating
    1121
    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

    It's not really a constraint, same reason a docked item cannot be an active item.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  7. #7
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
    jromero is on a distinguished road

      0  

    Default

    Quote Originally Posted by CarClub View Post
    That is a pretty bizarre constraint. There are no warnings in the docs about this sort of thing at all.
    I agree, not that it's a bizarre constraint because it makes sense, but it should be documented.

Thread Participants: 2