Threaded View

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Location
    Sweden
    Posts
    7
    Vote Rating
    0
    TROSSAB is on a distinguished road

      0  

    Default Answered: use segmented buttons as tabs

    Answered: use segmented buttons as tabs


    Hello,

    I'm trying to use the segmented buttons to shift views in my container.
    I've tried out the setActiveItem function but i dont quite get it right.

    Here is my code:
    Code:
    {            title: 'Historik',
                group: 'Meny',
    //            layout: 'vbox', // this makes me see both option 1 and 2..
                items: [{
                    xtype: 'toolbar',
                    docked: 'top',
                    ui: 'dark',
                    scrollable: false,
                    items: [{
                        xtype: 'spacer'
                    },{
                        xtype: 'segmentedbutton',
                        allowDepress: false,
                        items: [{
                            text: 'Option 1',
                            pressed: 'true',
                        },{
                            text: 'Option 2',
                            handler: function() {
                                console.log("pressed 2");
                                
                                /*
                                * - change view something like a tabpanel.
                                */
                                //this.parent.setActiveItem();
                                //Ext.ComponentManager.get("services_id").setActiveItem("option_2");
                            }
                        }]
                    },{
                        xtype: 'spacer'
                    }]
                },{
                    id: 'option_1',
                    html: "hello this is the first tab"
                },{
                    id: 'option_2',
                    html: "hello, this is the second one"
                }]
    Any help would be appreciated. Thanks.

  2. Code:
    {
       // you container
       layout:'card',
       id:'YOUR_CONTAINER_ID',
       items:[
          {
             //toolbar
             items:[
                 {
                     //segmentedbutton
                     items:[  
                         {
                           //your button
                           text: 'Option 2',
                           handler: function() {
                               console.log("pressed 2");
                               var container=Ext.getCmp("YOUR_CONTAINER_ID");
                              //or container = this.getParent().getParent().getParent();
                              //or  container = this.up('xtype of your container')
                              container.setActiveItem("#option_2");
                           }
    }
                     ]
                 }
             ]
          },
          {
               // your view
               id:'option_1'
          },
          {
               // your view
               id:'option_2'
          }
       ]
    }

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar