Skip to content

Column-level CaptionParams / ContentParams / ShowContentAs dropped in datagrid_builder #547

@ako

Description

@ako

Discovered while cleaning up v0.10.0 fixture loose ends (commit 4069b601)

Symptom

MDL with a templated column caption + parameters silently loses CaptionParams, ContentParams, ShowContentAs, and Content properties on round-trip.

Input MDL (mirrors Studio-Pro-generated Main.Product_Select from LatoProductInventory):

column Name (
  Attribute: Name,
  Caption: '{1}',
  CaptionParams: [{1} = Name],
  ShowContentAs: dynamicText,
  Content: 'Name',
  ColumnWidth: manual,
  Size: 8
) {
  textfilter tfName
}

DESCRIBE output after mxcli exec:

column Name (Attribute: Name, Caption: '{1}', ColumnWidth: manual, Size: 8) {
  textfilter tfName
}

CaptionParams, ShowContentAs, and Content are silently dropped.

Studio Pro consequence

mx check reports CE0720 "Place holder index 1 is greater than 0, the number of parameter(s)." — the BSON has Caption: '{1}' set as a TextTemplate, but the TextTemplate's parameter bindings list is empty.

Root cause location

mdl/backend/mpr/datagrid_builder.gocloneAndUpdateColumnPropertiescase "header": (around line 294):

case "header":
    entry := columnPropertyIDs["header"]
    result = append(result, buildColumnHeaderProperty(entry, caption))

buildColumnHeaderProperty receives the literal caption string but no parameter list. CaptionParams arrive at the column spec via child.Properties in the executor (see cmd_pages_builder_v3_widgets.go: buildDataGridV3 around line 110), but aren't propagated through DataGridColumnSpec to the backend.

Same issue likely applies to:

  • case "content": when ShowContentAs: dynamicText is set with Content + ContentParams
  • case "tooltip": if Tooltip is a TextTemplate

Acceptance

  • DataGridColumnSpec carries optional CaptionParams, ContentParams (map[string]string of placeholder → attribute path)
  • buildColumnHeaderProperty (and equivalent for content, tooltip) build TextTemplate values with the parameter list populated
  • Fixture feat(tui): check enhancements, command palette, session restore #31 PD06 restored to the templated-caption pattern matching Studio Pro reference
  • DESCRIBE round-trips Caption: '{1}', CaptionParams: [{1} = Name] losslessly
  • mx check no longer reports CE0720 on the restored fixture

Out of scope

  • TextTemplate parameter support outside DataGrid columns (likely already works for top-level widget properties via SetTextTemplateWithParams — verify and document)

Priority

Medium. Cosmetic for end users (column headers can use plain text); blocks DESCRIBE/edit round-trip for projects that already have templated column captions (most production projects do — see LatoIntegrations.Products_Overview, Main.Product_Select etc. in test fixtures).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions