|
| 1 | +-- Bug: a widget written in a pluggable widget's body that the widget has |
| 2 | +-- nowhere to put was BUILT AND THROWN AWAY, with no diagnostic from `check` |
| 3 | +-- and no error from `exec`. `DESCRIBE PAGE` afterwards showing the widget gone |
| 4 | +-- was the only way to find out. |
| 5 | +-- |
| 6 | +-- Reported by ako/view-entity-examples FINDINGS §2, as a Data Grid 2 filter. |
| 7 | +-- The form that vanished is the one `mxcli syntax page widgets` documented: |
| 8 | +-- |
| 9 | +-- DATAGRID dg (...) { COLUMN c (Attribute: A) FILTER f { TEXTFILTER tf (...) } } |
| 10 | +-- |
| 11 | +-- Two things are wrong with it, and only together do they hide: |
| 12 | +-- 1. `FILTER` is the GALLERY keyword for the filters placeholder. DataGrid 2 |
| 13 | +-- spells the same property `controlbar` (widgetSlotKeywordOverrides). |
| 14 | +-- 2. `widgetV3` is `type name props? body?`, so `COLUMN c (…) FILTER f { … }` |
| 15 | +-- is a COLUMN WITH NO BODY followed by a SIBLING filter widget — nothing |
| 16 | +-- binds the second to the first. The sibling landed among the grid's own |
| 17 | +-- children, matched no container, and was dropped. |
| 18 | +-- |
| 19 | +-- Root cause: the four passes that place a pluggable widget's children |
| 20 | +-- (applyChildSlots, applyObjectLists, and two auto-discovery passes) each |
| 21 | +-- `continue` past a child they do not recognise, and applyChildSlots parks |
| 22 | +-- the leftovers in `defaultWidgets` — which is assigned only if the widget |
| 23 | +-- declares a `template` slot. A Gallery has one; DataGrid 2 does not, so its |
| 24 | +-- leftovers were discarded. Not datagrid-specific: one `continue` per pass, |
| 25 | +-- shared by every pluggable widget. |
| 26 | +-- |
| 27 | +-- Fix: MDL-WIDGET30 at check time and a refusal in buildPluggable at exec time, |
| 28 | +-- both from unroutedPluggableChildren() so they cannot disagree. The message |
| 29 | +-- names the spelling THIS widget uses for the same slot, since an author who |
| 30 | +-- copied a gallery example needs `controlbar`, not a list to search. |
| 31 | +-- |
| 32 | +-- This repro is a plain .mdl, not .fail.mdl, on purpose: MDL-WIDGET30 needs the |
| 33 | +-- parent widget's DEFINITION, which comes from the project's installed .mpk, and |
| 34 | +-- `make check-mdl` runs `check` with no project (see the Makefile's note on |
| 35 | +-- #891/#892). The refusal is covered by widget_unrouted_children_test.go; this |
| 36 | +-- file records the working spellings so they stay working. |
| 37 | +-- |
| 38 | +-- Reading the definition from the project's .mpk is also what keeps the rule |
| 39 | +-- current: Data Widgets ships DataGrid 2 in every Mendix 11 app, and upgrading |
| 40 | +-- that module from the Marketplace changes what mxcli sees with no mxcli release. |
| 41 | +-- |
| 42 | +-- Measured end to end on Mendix 11.13.0, DataGrid 2 (Data Widgets) 3.4.0, with |
| 43 | +-- the guard stubbed as the control: |
| 44 | +-- guard stubbed, `exec --no-check` the FILTER form |
| 45 | +-- → "Created page", exit 0 … and `describe page` shows |
| 46 | +-- `column MeterCode (Attribute: MeterCode, Caption: 'Meter')` with NO |
| 47 | +-- filter. That is the reported defect: a success that lost the widget. |
| 48 | +-- guard in place, same script → refused, exit 1, naming `controlbar` |
| 49 | +-- guard in place, THIS file → "Replaced page", and `describe page` shows |
| 50 | +-- `column … { textfilter tf }` — it persisted |
| 51 | +-- mx check on the result → 0 errors |
| 52 | + |
| 53 | +create module VFilterDrop; |
| 54 | + |
| 55 | +create entity VFilterDrop.Meter ( |
| 56 | + MeterCode: String(50), |
| 57 | + Readings: Integer, |
| 58 | + LastSeen: DateTime |
| 59 | +); |
| 60 | + |
| 61 | +create page VFilterDrop.Meters ( |
| 62 | + title: 'Meters', |
| 63 | + layout: Atlas_Core.Atlas_Default |
| 64 | +) { |
| 65 | + datagrid dgMeters (datasource: database VFilterDrop.Meter) { |
| 66 | + -- The working form: the filter goes INSIDE the column's own braces, and |
| 67 | + -- must match the column attribute's type. |
| 68 | + column colCode (attribute: MeterCode, caption: 'Meter') { |
| 69 | + textfilter fCode (attribute: MeterCode) |
| 70 | + } |
| 71 | + column colReadings (attribute: Readings, caption: 'Readings') { |
| 72 | + numberfilter fReadings (attribute: Readings) |
| 73 | + } |
| 74 | + column colSeen (attribute: LastSeen, caption: 'Last seen') { |
| 75 | + datefilter fSeen (attribute: LastSeen) |
| 76 | + } |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +-- Control: on a GALLERY the very same `filter { … }` block is correct — it is |
| 81 | +-- that widget's own keyword for the filters placeholder. A rule that simply |
| 82 | +-- banned the keyword would have broken this page, which is why the fix asks |
| 83 | +-- the parent's definition rather than matching on the word. |
| 84 | +create page VFilterDrop.MeterGallery ( |
| 85 | + title: 'Meter gallery', |
| 86 | + layout: Atlas_Core.Atlas_Default |
| 87 | +) { |
| 88 | + gallery galMeters (datasource: database VFilterDrop.Meter, desktopcolumns: 3) { |
| 89 | + filter galFilter { |
| 90 | + textfilter fGalCode (attribute: MeterCode) |
| 91 | + } |
| 92 | + template galTemplate { |
| 93 | + dynamictext txtCode (content: '{1}', contentparams: [{1} = MeterCode]) |
| 94 | + } |
| 95 | + } |
| 96 | +} |
0 commit comments