1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    2
    Vote Rating
    0
    rndm is on a distinguished road

      0  

    Default Unanswered: Image grid - wrap items within panel

    Unanswered: Image grid - wrap items within panel


    I'm trying to put 100 images (50x50pixels) in a panel that is 500x500pixels. I want 10 images per line, right next to one another, filling up the entire panel. I've been stuck for 2 days on this, and would really appreciate help. The code as follows:

    note: i've also tried with a 10x10 array, listing each row as a different item with vbox, but it didn't work. thank you in advance for any help!

    App.data.Images = new Array(); //I put all the images into an array
    for (var i=0; i<100; i++){ //One by one, fill the array
    App.data.Images[i] = new Ext.Panel({
    width: 50,
    height: 50,
    style: 'background-color: #ff0000; border: thin solid blue;' //for simplicity here, just using solid colors instead of images
    )};
    };

    App.views.ImageContainer = new Ext.Panel({ //The container, sized to hold 100 images
    width:500px,
    height:500px,
    items:[App.views.ImageGrid]
    });
    App.views.ImageGrid = new Ext.Panel({
    layout: ????? //I haven't been able to get any layout to work
    items: [App.data.Images]
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,678
    Vote Rating
    435
    Answers
    3110
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    If you will always know the number of items then you can simple do some CSS and use the Multi-column layout

    http://www.w3.org/TR/css3-multicol/
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread