Data Grid 2 Number Filter + Personalization causing “Cannot assign to read-only property” error

0
ScenarioI am using Data Grid 2 with column filters enabled. For a better user experience, I have enabled “Store in personalization” for filters so that:Filter values persist across page refreshFilter values are retained even after logout/loginUsers don’t have to reapply filters every timeAdditionally, I maintain a separate persistable entity to track which columns have active filters, so that I can show a visual indication (icon/symbol) when a filter is applied on a column.This setup has been working fine for a long time.Current IssueRecently, when applying Number Filters (for example, Integer/Decimal columns), the application started throwing the following client-side error: An error occurred while validating new value set by <DataGrid>.numberFilterX: Cannot assign to read only property 's' of object '[object Object]' The stack trace points to:DatagridNumberFilter.jssetValueFilter validation logicThis error occurs only when:The column filter type is NumberStore in personalization is enabledText filters with personalization enabled are still working fine.ObservationsThis issue started recently, without any functional changes to the pageIt appears to be related to strict immutability of personalization stateThe personalization/filter state seems to be frozen (read-only), and the Number Filter tries to mutate it during validationDisabling “Store in personalization” for Number Filters immediately resolves the errorHowever, disabling personalization means filter values are lost after logout/login, which impacts the intended UXConstraintsThe existing UX and functionality cannot be redesignedPersisting filter values across sessions is a business requirementUsing external filter panels instead of column filters is not an optionThis behavior worked earlier, so we are trying to understand whether this is:A known limitationA regressionOr an intended behavioral change in recent Mendix versionsIs this a known issue or limitation with Data Grid 2 Number Filters + Personalization in recent Mendix versions?Has anyone found a safe workaround that allows Number Filters to persist across sessions without throwing this error?Is there any recommended pattern from Mendix for handling persisted numeric column filters in Data Grid 2?Are there any upcoming fixes or documented guidance related to this behavior?Any insights, confirmation, or recommendations would be greatly appreciated.Thanks in advance!
asked
2 answers
0

From how you describe it (it worked before and started failing recently), this looks much more like a widget bug or regression than an intended limitation.


The "read-only property" error strongly suggests that when personalization restores the filter state, that state becomes immutable. The Number Filter then tries to change it during validation and blows up. The fact that text filters still work, while number filters don’t, fits this explanation quite well. So this doesn’t look like a model or configuration issue on your side, but rather a Data Grid 2 client-side behavior.


The suggested workarounds make sense. Turning off "Store in personalization" for numeric filters immediately fixing the issue is a strong indicator of where the problem is. However, that obviously conflicts with your UX requirement.


The "persist the values yourself and reapply them on page load" idea is valid in principle, but in practice it often means applying the filter in the datasource logic rather than fully restoring the column filter UI state. It’s worth being clear about that, since restoring the exact column filter UI for numbers is not always straightforward.


In short: this doesn’t look like your mistake. It’s very likely a Data Grid 2 regression related to Number Filters + personalization. Sharing the exact Mendix and Data Grid 2 versions and opening a Mendix support ticket is probably the best next step.


answered
1

Yes — this is a known limitation/behaviour with Data Grid 2 when using Number Filters together with “Store in personalization”. The bug happens because when personalization restores the filter state, the internal filter object becomes immutable (read-only). The Number Filter widget tries to update that state during validation, which triggers:

Cannot assign to read-only property … when applying a number filter with personalization enabled.

Number Filters mutate their internal state differently than Text Filters, so they fail only when personalization is turned on and the state is frozen.

Key points

Personalization of text filters still works

Number Filters with personalization currently fail

Disabling “Store in personalization” fixes the error immediately

This is widget behaviour, not a model/config issue

Current recommendations

• Keep personalization off for numeric column filters

• If persistence is required, persist numeric filter values manually in your own entity and reapply them when the page loads

• Log this as a bug so Mendix can address it in a future release

This is not a problem with your implementation — it’s a limitation of the widget’s current version.

answered