Results 1 to 3 of 3

Thread: Cannot get Grid to automatically size columns

  1. #1
    Sencha Premium User
    Join Date
    May 2015
    Posts
    165

    Default Cannot get Grid to automatically size columns

    I have created a fiddle that:

    1. Create a grid
    2. Create a store
    3. Add columns to grid
    4. Add store to grid

    I have the wellknown bit of code that allegedly autosizes the columns included but it does not work in this instance.

    Please advise as to how to tell the grid to automatically size the column widths to match the contents

    Thanks

    https://fiddle.sencha.com/#view/editor&fiddle/1qsj

  2. #2
    chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    There is the autoSize method for grid columns that does this. So you your case, after setting the columns, you must do something like this:
    Code:
    Ext.Array.forEach(myGrid.getColumns(), function(column) {
        column.autoSize();
    });

  3. #3
    Sencha Premium User
    Join Date
    May 2015
    Posts
    165

    Default

    You're a star, thanks very much

Similar Threads

  1. Replies: 3
    Last Post: 25 Feb 2014, 5:12 AM
  2. Replies: 1
    Last Post: 21 May 2012, 4:48 AM
  3. Adjust size automatically with vbox layout
    By pablogomezp in forum Sencha Touch 2.x: Q&A
    Replies: 4
    Last Post: 17 Apr 2012, 10:36 AM
  4. GRid columns doesnt get rezie automatically
    By alok000707 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 16 Feb 2011, 10:28 PM

Posting Permissions

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