1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    4
    Vote Rating
    0
    HustlaS is on a distinguished road

      0  

    Default Unanswered: setActiveItem in Container don't work

    Unanswered: setActiveItem in Container don't work


    Hi
    I want change the card in my Container with setActiveItem but its dont work.
    I use Sencha Touch 2 PR4.

    thats my Container
    Code:
    Ext.define('TimeShift.view.ListContainer', {
        extend: 'Ext.Panel',
        id: 'ListContainer',
        alias: 'widget.ListContainer',
        layout: 'fit',
        config: {
            items: [
    
                { xtype: 'Activity' },
                { xtype: 'Project' }
          
            ]
    
        },
        initialize: function () {
            console.log('initialize ListContainer');
            this.callParent();
        }
    });
    List One

    Code:
    Ext.define('TimeShift.view.Activity', {
        extend: 'Ext.Panel',
        id: 'Activity',
        alias: 'widget.Activity',
        layout: 'card', 
        config: {
            items: [
                { xtype: 'list',
                    store: 'ActivityStore',
                    scrollable: 'vertical',
                    itemTpl: '<div class="contact">{Purpose}</div>', 
                    items: [
                        { xtype: 'toolbar',
                            docked: 'top', 
                            title: 'Aktivit├Ąten'
                        }]
                }]
        }, 
        initialize: function () {
            console.log('initialize ActivityList'); 
            this.callParent();
        }
    });
    The second List has the same config

    ...and this is the controler part:

    Code:
    NaviList: {
                    itemtap: function (obj, idx, target) {
                                          
                        Ext.getCmp('ListContainer').setActiveItem('Project', { type: 'slide', direction: 'left' });
    Ext.getCmp('Activity').setHidden(true);
    console.log('Item Controll', Ext.getCmp('ListContainer').getActiveItem());
    ....
    with console.log I can check the ActiveItem and its correct but the view dont change the card.
    When I set
    Code:
    Ext.getCmp('Activity').setHidden(true);
    its works but I dont want set this everytime.

  2. #2
    Sencha - Training Team mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    691
    Answers
    21
    Vote Rating
    12
    mrsunshine will become famous soon enough

      0  

    Default


    you have to use layout:'card' in your list container
    to switch the views with setActiveItem()

Thread Participants: 1

Tags for this Thread