Skip to content

DataGrid 2 column Attribute: binding not propagated into widget template (AttributeRef stays null) #202

@ako

Description

@ako

Problem

When a `DATAGRID` widget's column is defined with an attribute binding like
`COLUMN Sku (Caption: 'Sku')`, the executor creates a column object in the
DataGrid 2 template's `columns` property, but the column's `AttributeRef`
slot stays `null`. DESCRIBE PAGE output confirms the attribute is lost —
columns show generic headers without bindings.

This affects ALL DataGrid 2 columns, not just association-sourced grids.
Discovered while fixing #198 (association DataSource).

Reproduction

```sql
CREATE PAGE Module.Detail (Title: 'T', Layout: Atlas_Core.Atlas_Default)
{
DATAVIEW dv (DataSource: DATABASE Module.Order) {
DATAGRID lines (DataSource: $currentObject/Module.OrderLine_Order) {
COLUMN Sku (Caption: 'Sku')
COLUMN Quantity (Caption: 'Qty')
}
}
};
```

BSON of a column after mxcli exec:
```json
{
"$Type": "CustomWidgets$WidgetProperty",
"Value": {
"$Type": "CustomWidgets$WidgetValue",
"AttributeRef": null,
"PrimitiveValue": "attribute",
...
}
}
```

Expected (from a Studio Pro-created DataGrid 2 column):
```json
{
"AttributeRef": {
"$Type": "DomainModels$AttributeRef",
"Attribute": "Module.OrderLine.Sku",
"EntityRef": null
}
}
```

Root cause

The pluggable widget engine builds the column object from the template
defaults but doesn't populate the `attribute` property (PropertyKey in
the widget's type definition) with the MDL COLUMN's attribute binding.

Suggested fix

In the pluggable widget column builder, when the parent DATAGRID widget's
entity context is known (from its DataSource — database source or
association source destination), and the COLUMN has a bare identifier
argument like `Sku`, resolve it to `Module.Entity.Sku` and set the
column property whose type is `Attribute` to that value.

This should work for both native DataSource types (database, microflow,
association) since the entity context is already propagated to child
widgets via `pb.entityContext`.

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