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

    BUG REPORT: ListGrid "Auto Fit All Columns" Inconsistency

    When using the "Auto Fit All Columns" option from the ListGrid header context menu, the resulting layout is inconsistent depending on whether the user previously resized a column or not. This issue can be reproduced on the following demo in the SmartClient showcase:

    To reproduce, follow the steps provided:
    1. Click on tab "autoFitColumns.js"
    2. Change line #3 width to 1000
    3. Click on "Try it" button
    4. Right click on any column header and select "Auto Fit All Columns"
    5. Result: "Country" column will be resized to be very wide
    6. Manually adjust the size of any column
    7. Right click on any column header and select "Auto Fit All Columns"
    8. Result: auto fit works and all the columns will be resized in a reasonable manner
    Is this the expected behavior? If so, is there a configuration to prevent this from happening and provide a consistent experience?

    Wide Result:
    Click image for larger version

Name:	wide_result.png
Views:	22
Size:	17.2 KB
ID:	266417

    Thin Result:
    Click image for larger version

Name:	thin_result.png
Views:	21
Size:	17.3 KB
ID:	266416

    Thank you for your time.

    ListGrids have a feature autoFitFieldsFillViewport, enabled by default, which causes the grid to attempt to fill its specified width by expanding the autoFitExpandField rather than shrinking it to fit its content and/or title.

    If the autoFitExpand field is not explicitly specified, the grid will pick the first field with no explicitly specified width.

    What's happening when you resize a field in the grid is that all the field widths become static rather than dynamic. This ensures the user's drag-resize behaves intuitively and sizes applied by the user "stick."
    This action also means that the default logic to determine the autoFitExpandField will come up empty handed- every field now essentially has a specified width, so it won't cause a field to expand and fill the viewport.

    Anyway - the shorter answer is that you can get the behavior you're after by setting autoFitFieldsFillViewport:false on your grid

    Isomorphic Software