Search code examples
layoutextjs4sencha-touch

Card layout - Active Item - sencha touch


I am having one view which is in card layout. Card is having 2 sub views.

Now I want to get the activeitem. In extjs I am using this code:

 activeItem = layout.getActiveItem().itemId;

but in sencha touch , for card layout , there is no such method named getActiveItem() for card layout. I have referred sencha touch docs and I found that.

Anybody knows the alternative for this?


Solution

  • var panel = Ext.create('Ext.Panel', {
    layout: 'card',
    items: [
        {
            html: "First Item"
        },
        {
            html: "Second Item"
        },
        {
            html: "Third Item"
        },
        {
            html: "Fourth Item"
        }
    ]
    });
    
    panel.setActiveItem(1);
    

    It also have getActiveItem() method to work with.

    Refer http://docs.sencha.com/touch/2-1/#!/api/Ext.layout.Card