Configuring Grid column widths

    Grid does by default check the widths of all cells on the first pageful of data and allocate column widths based on that. If there’s room to spare, each column gets and equal share of the extra pixels.

    There is usually one or maybe two columns that would most benefit from some additional breathing room, but Grid can’t know which columns that is unless you tell it. You can do so using the method for a column.

    When setting one column to expand, all the extra space gets allocated to that column. This might instead cause the other columns to be too tightly spaced. One easy way of avoiding this is to use to set a pixel size for columns that are not expanded.

    Java

    Java

    With horizontal scrolling, it might be desirable to still keep columns identifying each row visible all the time so that it’s easier for the user to interpret the data. This can be done by freezing a number of columns, counted from the left, using the method. By default, only the column showing selection state in multiselect mode is frozen. This column can also be unfrozen by setting the count to -1.

    If the width of Grid is again increased so that all columns can fit without scrolling, the frozen columns will behave just as any other column.