Repository navigation
fix: write a DataGrid 2 column's Visible expression - #1034
Merged
Merged
Conversation
Every expression spelling of a column's `Visible:` — `$showPrices`, `if … then … else …`, `not(…)`, `[cond]` — passed check and exec and was stored as `true`, so the column was always visible. The visitor lowers an expression to the key VisibleIf and keeps only plain values under Visible; the column writers read only visible/Visible. - types.ItemPropertyAliases: `visible` <- `VisibleIf`, used by the widget engine on create and by ALTER `set (Visible: …) on grid column(…)`, which refused it as "column property VisibleIf not found". Widget defs regenerate at generator version 18. - columnSpecProperties: ALTER insert/replace column hands the builder Visible (and DynamicCellClass in any case) as the string it reads; a `Visible: false` bool was dropped there too. - describe prints the bare expression, which now round-trips. - MDL-WIDGET43: a column's visibility is evaluated once for the grid, with no row object, so $currentObject there is CE0117 (measured on 11.14.0). check refuses it on create, insert and set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P65SqmwwvbWdJVRwhYiMQw
ako
force-pushed
the
claude/nice-einstein-a74lz4
branch
from
October 8, 2026 04:52
0579587 to
687a09f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A DataGrid 2 column's
Visible:expression was silently dropped. These spellings all passedcheck, andexecreported "Created page", but the column was stored with Expressiontrue, i.e. always visible:Visible: $showPricesVisible: if … then … else …visible: not(…)Visible: [cond]Only the old quoted spelling
Visible: '<expr>'was kept. On the ALTER side:alter page … set (Visible: <expression>) on grid column(…)was refused with "column property VisibleIf not found".Visible: false.Cause
The visitor stores every expression spelling of
Visibleunder the keyVisibleIf, the key a page widget's conditional visibility reads. Only plain values stay underVisible. The column writers read onlyvisible/Visible:types.ItemPropertyAliases, which had noVisibleIfalias.set:resolveColumnPropertyKeyuses the same table, so it refused the key.insert/replace:buildColumnSpecFromASTpasses the properties towidgetobj.BuildDataGrid2Column, which reads the exact key"Visible"and only as a string, so a boolfalsewas dropped too.This is the mirror image of
bug-tests/widget-visible-expression.mdl, where page widgets readVisibleIfand droppedVisible.Fix
types.ItemPropertyAliasesgetsvisible←VisibleIf. This fixes create and ALTERset.WidgetDefGeneratorVersiongoes to 18, so existing projects regenerate their datagrid def.columnSpecPropertiesgives the column builderVisibleas the string it reads (fromVisibleIf, or a staticfalse). It also passesDynamicCellClassthrough in any letter case.widgetConditionMDL, as page widgets do), and the output round-trips.visibleexpression is evaluated once for the grid. Its widget schema declares nodataSource, unlikecolumnClass, so there is no row object. On Mendix 11.14.0,mx checkreports CE0117 for every column whoseVisibleuses$currentObject; those columns only appeared to work because the value was dropped.checknow refuses this on create, insert and set, and suggests a page variable or parameter.Verification
columnSpecPropertiesfor each spelling (the quoted form andtrueare controls)visiblealiasresolveColumnPropertyKey("VisibleIf")$currentObjectVisible is the control)truefor each expression spelling.setand ALTERinsert, using a page variable.mx checkreports 0 errors.execrefuses a$currentObjectcolumn Visible as MDL-WIDGET43.make build && make test && make lint && make check-mdlandmake check-findingsall pass.Also
mdl-examples/bug-tests/datagrid-column-visible-expression.mdl.page.columnsyntax help and the quick reference, which showed the quoted spelling.03-page-examples.mdlcolumn example, which now usesvisible: $showStockColumn.docs-wiki/bug-patterns/silent-property-drop.md, and a CHANGELOG entry.Not covered:
Visible: Attr in (…)on a column is still ignored without a warning. That form lets the attribute decide visibility, and a column has no row to read it from.🤖 Generated with Claude Code
https://claude.ai/code/session_01P65SqmwwvbWdJVRwhYiMQw
Generated by Claude Code