Results 1 to 2 of 2

Thread: Image grid - wrap items within panel

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,317
    Answers
    3881
    Vote Rating
    1291
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •