Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Flexible column widths

    I would like to have a ListGrid with variable width, having some columns with fixed widths and some with variable widths depending on the remaining space.

    For example:

    The grid's initial width is 300 pixels and it has 4 columns. I have 2 columns in it with fixed width (50 pixels), which means there are 200 pixels left for the other two columns. I want these two columns to be equal in width (50% of the remaining space), thus 100 pixels each. If the browser is resized to 500 pixels, the width of these two columns should be 200 pixels.

    Is this possible? I think setting the width to '50%' means "from the total grid width" (instead of the remaining grid width).

    #2
    We actually interpret % as % of remaining width (because this is usually more useful, as in this case). So yes, 50% will give the behavior you want.

    Comment


      #3
      I looked into the documentation of "width" for a ListGridField and you do mention this behavior indeed. Sorry for not noticing before. I thought I tried that, but I most likely didn't, because it works as expected. Credits to you!

      I would also like to have a minimum width for these columns and I guess this isn't possible, because the property is available for a canvas, which a column isn't. I did try and it doesn't work, but maybe somebody has a trick to achieve this.

      Comment


        #4
        In 8.0 there are auto-sizing properties that allow a column to be sized to the largest data value or to the title (see listGridField.autoFitWidth) and there is also a grid-wide minimum (listGrid.minFieldWidth).

        Comment


          #5
          Isomorphic: Your earlier post mentioned a "grid-wide" minimum. Is there a "field-level" minimum. As near as I can tell, the answer is no. (I searched the javadocs, the forum, and did some testing: if I set a column to use "*", then it may shrink to a very small width when its part of small container, even though I would like it to have a minimum width. Note: A grid-wide min doesn't help here.)

          Comment

          Working...
          X