Threaded View

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

      0  

    Default Answered: Change a vbox into a hbox and vice versa on orientation change

    Answered: Change a vbox into a hbox and vice versa on orientation change


    Hi there,

    I've built a horizontally scrollable hbox layout container, docked on top, filled with other sub-containers, which I want to transform into a vbox layout (scrollable vertically, docked to the left) on orientation change.

    Right now I'm doing something like this on resize:

    Code:
    var hboxLayout = Ext.getCmp('hboxLayoutID');
    Ext.getCmp('hboxLayoutParentID').removeAll(false, true);
    
    if(Ext.Viewport.getOrientation()=='landscape'){
        hboxLayout.setDocked('left');
        hboxLayout.setLayout({
                pack: 'center', 
                type: 'vbox'
            });
        hboxLayout.setScrollable({
                direction: 'vertical'
            });
        hboxLayout.setHeight('auto');
        hboxLayout.setWidth(100);
    }else{
        hboxLayout.setDocked('top');
        hboxLayout.setLayout({
                pack: 'center', 
                type: 'hbox'
            });
        hboxLayout.setScrollable({
                direction: 'horizontal'
            });
        hboxLayout.setHeight(100);
        hboxLayout.setWidth('');
    };
    Ext.getCmp('hboxLayoutParentID').add([hboxLayout]);
    It kinda does what it's supposed to (it snaps to the left / top, becomes vertically / horizontally scrollable, sets the correct width / height), EXCEPT re-aligning the sub-containers properly - they either remain aligned horizontally (if the initial view was landscape) or vertically (for initial portrait view).

    Am I missing something / doing something wrong?

  2. No. 1:
    You may create two views and show the other view on the fly (destroying the first if you need to)

    No. 2:
    You create two containers in the main container. One with hbox and the other with vbox.
    Then you transfer the content to the other container as needed.

    The second is especially good if you have forms and do not want to loose the selections/entered text.

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