Results 1 to 3 of 3

Thread: horizontal scroll bar for grid with dynamic number of columns

  1. #1
    Sencha User
    Join Date
    Nov 2014
    Posts
    53
    Answers
    4
    Vote Rating
    0
      0  

    Default Answered: horizontal scroll bar for grid with dynamic number of columns

    Hello,

    I have a grid with dynamic number of columns. There can be up to 35 columns. Each column is configured with "flex":1. From what I understand, flex "force fits" all the child items (columns) into the available width of their parent container (grid). So regardless of there being 1 column or 35 columns, they will take up all the space avaialble in the grid, nothing more or less. Thus, a horizontal bar will never be shown.

    The issue is with lots of columns it becomes hard to read the headers since all columns are crammed into the available width.

    So I instead replaced "flex" with "width". This works fine so as long as there are enough columns. If the columns are too few, they dont take up all the space of the grid leaving the rest of the grid transparent.

    So what would be the best way to handle this? Basically, I need to use width when there are a lot of columns and flex when only a few columns.

    Are there any alternatives to showing horizontal scrolll bar besides replacing flex with width?

    thanks

  2. You can simple have flex on one of the columns, or the last column to fill the gap?

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    You can simple have flex on one of the columns, or the last column to fill the gap?

  4. #3
    Sencha User
    Join Date
    Nov 2014
    Posts
    53
    Answers
    4
    Vote Rating
    0
      0  

    Default

    Brilliant! thanks Scott!

Similar Threads

  1. How to create a grid with dynamic number of columns
    By rahulpatel in forum Ext GWT: Q&A
    Replies: 5
    Last Post: 5 Mar 2012, 12:52 PM
  2. Replies: 2
    Last Post: 19 May 2009, 9:48 PM
  3. Dynamic column in grid, and how to scroll in horizontal
    By OiuNt in forum Ext 2.x: Help & Discussion
    Replies: 13
    Last Post: 17 Dec 2008, 8:02 AM
  4. Grid with dynamic number of columns
    By hyankov in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 18 Dec 2007, 7:30 AM

Posting Permissions

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