You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataGrid (com.mendix.widget.web.datagrid.Datagrid) is constructed by two disjoint code paths today. They share the embedded template (sdk/widgets/templates/mendix-11.6/datagrid.json) and produce the same $Type, but the BSON construction is independent — bugs fixed in one path don't fix the other (cf. #64, which only affected the engine path because datagrid_builder.go has its own setAttributeRef helper at line 776).
⚠ partially via embedded template; some only apply to the keyword path
The engine path is the only path for every other pluggable widget (Accordion, Maps, AreaChart, etc.). For DataGrid specifically it's a strict subset of the keyword path's feature set.
Why consolidate
Bug fixes land in two places. The Generate Overview Page - DataGrid 2 is not up to date #64 fix to setAttributeRefField would have been one-liner across both paths had they shared a helper; today the keyword path's setAttributeRef had to be replicated correctly when the engine equivalent was first written.
Test coverage gap. Integration fixtures (mdl-examples/doctype-tests/31-pluggable-datagrid-gallery-v010-examples.mdl) only exercise the keyword form, so the engine path regressed undetected until a user reported it (Generate Overview Page - DataGrid 2 is not up to date #64).
1467 + 1149 lines of split logic for one widget plus the catalogue — collapsing the keyword path into the engine would be one of the largest single simplifications in mdl/backend/mpr/.
Proposed approach
Phase the move so each step is independently mergeable and reversible:
Port CONTROLBAR routing into the engine — recognize controlbar as the parent's filtersPlaceholder slot when the parent is com.mendix.widget.web.datagrid.Datagrid. New .def.json field headerSlots[] lets the engine route a child keyword to a named container property. (Generic: also fixes Gallery filter bars.)
Port custom-content columns — when an object-list item carries child widgets, promote them to the item's customContent / template sub-property. Today's engine drops them; the keyword path treats ChildWidgets as a first-class column attribute.
Port per-column filter routing — extend the engine's object-list dispatch to recognize a nested filter { textfilter … } block as filling the column's filter sub-property slot.
Port the keyword's CE0463 patches — fold the AllowUpload / property-ordering / ClientTemplate / boolean-default fixes into the embedded template plus the engine's serialization path so they apply to every widget that reads the same template.
Switch the dispatch — once feature parity is reached, route datagrid to pluggableEngine.Build (re-using widget ID com.mendix.widget.web.datagrid.Datagrid from the keyword) and delete datagrid_builder.go.
After Phase 5, the only DataGrid-specific code that should remain is the embedded template plus any per-widget propertyVisibility[] rules generated by #574.
Test plan
Existing fixture mdl-examples/doctype-tests/31-pluggable-datagrid-gallery-v010-examples.mdl should continue to pass mx check at zero errors after each phase.
Add a parallel mdl-examples/doctype-tests/31b-pluggablewidget-datagrid-examples.mdl that mirrors fixture 31 but uses pluggablewidget form throughout. Both must pass.
Roundtrip: describe of a DataGrid built by either path should produce equivalent MDL when re-executed.
DataGrid (
com.mendix.widget.web.datagrid.Datagrid) is constructed by two disjoint code paths today. They share the embedded template (sdk/widgets/templates/mendix-11.6/datagrid.json) and produce the same$Type, but the BSON construction is independent — bugs fixed in one path don't fix the other (cf. #64, which only affected the engine path becausedatagrid_builder.gohas its ownsetAttributeRefhelper at line 776).Current dispatch
mdl/executor/cmd_pages_builder_v3.go:271:datagrid dg (...) { column ... }buildDataGridV3→widgetBackend.BuildDataGrid2Widgetmdl/backend/mpr/datagrid_builder.go(1467 lines)pluggablewidget 'com.mendix.widget.web.datagrid.Datagrid' dg (...) { column ... }pluggableEngine.Build(def, w)mdl/executor/widget_engine.go+mdl/backend/mpr/widget_builder.go(also serves every other pluggable widget)Feature drift
The keyword path implements DataGrid-specific routing that the generic engine doesn't:
datagrid)pluggablewidget)Attribute:Caption:withCaptionParams:placeholdersClientTemplateParameterfor{1}/{2}column ... { dynamictext … })DataGridColumnSpec.ChildWidgets→customContentDataGridColumnSpec.FilterWidgetCONTROLBAR { … }(filtersPlaceholder)HeaderWidgetscontrolbaras a generic child — no routing to filtersPlaceholderThe engine path is the only path for every other pluggable widget (Accordion, Maps, AreaChart, etc.). For DataGrid specifically it's a strict subset of the keyword path's feature set.
Why consolidate
setAttributeRefFieldwould have been one-liner across both paths had they shared a helper; today the keyword path'ssetAttributeRefhad to be replicated correctly when the engine equivalent was first written..def.jsonfields (propertyVisibility[]per Widget property conditional visibility from editorConfig.js (CE0463 on VideoPlayer + Timeline) #574,objectLists[]per v0.10.0 Phase 1: object-list support in pluggable widget engine #538) only feed the engine path. The keyword path either ignores them or needs hand-porting.mdl-examples/doctype-tests/31-pluggable-datagrid-gallery-v010-examples.mdl) only exercise the keyword form, so the engine path regressed undetected until a user reported it (Generate Overview Page - DataGrid 2 is not up to date #64).mdl/backend/mpr/.Proposed approach
Phase the move so each step is independently mergeable and reversible:
controlbaras the parent'sfiltersPlaceholderslot when the parent iscom.mendix.widget.web.datagrid.Datagrid. New.def.jsonfieldheaderSlots[]lets the engine route a child keyword to a named container property. (Generic: also fixes Gallery filter bars.)ChildWidgetsas a first-class column attribute.filter { textfilter … }block as filling the column'sfiltersub-property slot.datagridtopluggableEngine.Build(re-using widget IDcom.mendix.widget.web.datagrid.Datagridfrom the keyword) and deletedatagrid_builder.go.After Phase 5, the only DataGrid-specific code that should remain is the embedded template plus any per-widget
propertyVisibility[]rules generated by #574.Test plan
mdl-examples/doctype-tests/31-pluggable-datagrid-gallery-v010-examples.mdlshould continue to passmx checkat zero errors after each phase.mdl-examples/doctype-tests/31b-pluggablewidget-datagrid-examples.mdlthat mirrors fixture 31 but usespluggablewidgetform throughout. Both must pass.describeof a DataGrid built by either path should produce equivalent MDL when re-executed.Related
LEGACYDATAGRIDfor native,DATAGRIDfor pluggable)