bricks/dist/docs/en/dynamiccolumn.md
yumoqing 1291f7fee3 fix: UiCode build_options uses valueField/textField fallback to 'value'/'text'
When valueField/textField are not explicitly set in opts, the auto-select
logic (line 1140) and nullable empty-option creation (lines 1144-1145) used
data[0][undefined] which returned undefined, causing:
- Single-option selects to show blank (auto-select failed)
- nullable empty options to have undefined keys

Now extracts vf/tf local variables with ||'value'/||'text' fallback at the
top of build_options(), used consistently throughout.
2026-05-29 23:03:52 +08:00

1.5 KiB

DynamicColumn

Control Function: A dynamic column layout container that automatically adjusts the number of grid columns and column width based on screen size and configuration. Suitable for responsive layout scenarios.
Type: Container Control
Parent Control: Layout

Initialization Parameters

Parameter Type Description
col_cwidth Number (Optional) The character width unit per column (based on charsize), used to calculate column width. If neither col_cwidth nor col_width is set, defaults to 20.
col_width Number (Optional) Fixed pixel width per column. Lower priority than col_cwidth.
col_cgap Number (Optional) Gap size between columns, measured in charsize units. Defaults to 0.5.
mobile_cols Number (Optional) Forced number of columns in mobile portrait mode. Defaults to 1.

Note: If neither col_cwidth nor col_width is provided, col_cwidth defaults to 20.

Main Events

  • on_parent
    Triggered when the control is added to a parent container. Used for initialization or recalculating column widths.

  • resize
    Triggered when the browser window size changes. Dynamically adjusts gridTemplateColumns and gap to fit the new dimensions.

  • charsize (from bricks.app)
    Triggered when the character size changes (usually due to font or zoom changes). Used to recalculate column widths and gaps based on character units.