1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Posts
    11
    Vote Rating
    0
    cdamon is on a distinguished road

      0  

    Default Unanswered: Lists in a scrollable Container

    Unanswered: Lists in a scrollable Container


    I'm trying to display two lists stacked vertically in a scrollable container. The lists should display all their items, and the container should scroll if necessary to allow the user to see all of both lists. The lists do not display at all. The container uses a 'vbox' layout and is vertically scrollable. I've tried a number of increasingly desperate approaches. The only thing that displays the lists is giving them a flex, but that is not what I want. Sample code below.

    Layout is a constant source of frustration with ST2. The default seems to be to not show something, or set the height or width to zero, unless things are set up just right. I assume that the emphasis on explicit metrics is due to the device displays not being resizeable, but defaulting to 'auto' would be much more useful, at least in development. Part of the frustration is that it would be trivial to do what I want without the framework.

    I'll try combining the lists and using grouping, though that's not really what I wanted either.

    Code:
    Ext.application({
    
    
        name: 'Test',
    
    
        requires: [
            'Ext.data.Store',
            'Ext.dataview.List'
        ],
    
    
        launch: function () {
    
    
            Ext.define('City', {
                extend: 'Ext.data.Model',
                config: {
                    fields: [{ name: 'city', type: 'string' }]
                }
            });
    
    
            Ext.create('Ext.data.Store', {
                storeId: 'CityStore',
                model: 'City',
                data: [
                    { city: 'Topeka' },
                    { city: 'Buffalo' },
                    { city: 'Sacramento' },
                    { city: 'Springfield' },
                    { city: 'Houston' },
                    { city: 'Akron' },
                    { city: 'Toledo' },
                    { city: 'Frankfort' },
                    { city: 'Buford' }
                ]
            });
    
    
            Ext.define('State', {
                extend: 'Ext.data.Model',
                config: {
                    fields: [{ name: 'state', type: 'string' }]
                }
            });
    
    
            Ext.create('Ext.data.Store', {
                storeId: 'StateStore',
                model: 'State',
                data: [
                    { state: 'Kansas' },
                    { state: 'New York' },
                    { state: 'California' },
                    { state: 'Ohio' },
                    { state: 'Texas' },
                    { state: 'Ohio' },
                    { state: 'Ohio' },
                    { state: 'Kentucky' },
                    { state: 'South Carolina' }
                ]
            });
    
    
            Ext.Viewport.add(Ext.create('Ext.Container', {
                fullscreen: true,
                layout: 'hbox',
                items: [
                    {
                        xtype: 'container',
                        layout: 'vbox',
                        scrollable: {
                            direction: 'vertical'
                        },
                        width: '30%',
                        items: [
                            {
                                xtype: 'list',
    //                            flex: 1,
                                itemTpl: '{city}',
                                store: 'CityStore'
                            },
                            {
                                xtype: 'list',
    //                            flex: 1,
                                itemTpl: '{state}',
                                store: 'StateStore'
                            }
                        ]
                    },
                    {
                        xtype: 'component',
                        width: '70%',
                        html: 'some other stuff'
                    }
                ]
            }));
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,784
    Answers
    3465
    Vote Rating
    833
    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


    If you are using ST 2.1 then the lists are always going to be individually scrollable but need a height to show so you need the flex. If you want the lists not to be scrollable and only the container you will need to use dataview instead of list but the style will be up to you.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 Premium Member
    Join Date
    Nov 2012
    Posts
    11
    Vote Rating
    0
    cdamon is on a distinguished road

      0  

    Default


    Thanks for the response. I didn't think to try Dataview. Instead, I went with a single grouped list, which works reasonably well for what I'm trying to do. Since it's a NestedList, I had to do a little work to get grouping to work, but it wasn't too hard.

    Layout (the lack thereof) is probably the most common source of frustration for me with ST, especially the fact that it's so easy to not get something laid out at all. I've seen that happen both by getting zero height or width, and by the JS execution thread simply falling off without creating the DOM. I'd rather see a bad layout than none at all if I've gotten something wrong. Also, it seems like defaulting to 'auto' height for anything in a scrollable container would help. In that case, I want the content to drive the sizing.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi