Skip to content

fix: use dataItemColumnValueExtractor for grouping with nested objects#1200

Merged
ghiscoding merged 1 commit into
masterfrom
bugfix/data-item-value-extractor
May 6, 2026
Merged

fix: use dataItemColumnValueExtractor for grouping with nested objects#1200
ghiscoding merged 1 commit into
masterfrom
bugfix/data-item-value-extractor

Conversation

@ghiscoding

@ghiscoding ghiscoding commented May 5, 2026

Copy link
Copy Markdown
Collaborator

fixes #227

vibe coded a fix with Copilot

Description

Fixes issue #227 where grouping does not work with dataItemColumnValueExtractor for accessing nested object properties.

Root Cause

When a column uses a custom dataItemColumnValueExtractor to access nested objects and grouping is applied to that column, the DataView's grouping logic ignored the extractor and tried to access the field directly, resulting in undefined values for grouping.

Reproduction Steps

  1. Define nested objects in data: { security: { fullName: 'foo' } }
  2. Create a column with field: 'security' and dataItemColumnValueExtractor to extract security.fullName
  3. Set grouping on that column
  4. Bug: Grouping shows as undefined instead of grouping by the extracted values

Solution

  • Added getGroupingValue() helper method to DataView that:
    • Checks if a grid reference is available with dataItemColumnValueExtractor
    • Finds the column definition matching the grouping field
    • Uses the extractor to get the value if available
    • Falls back to direct field access if no extractor or grid reference
  • Modified extractGroups() to use this helper for string field getters

Changes

Testing

  1. Create a grid with nested object data
  2. Use dataItemColumnValueExtractor to expose nested properties
  3. Add column grouping for a nested property
  4. Verify grouping works correctly with extracted values
  5. Verify grouping still works for non-extractor columns

Impact

  • Fixes grouping with custom extractors
  • No breaking changes
  • Grid reference must be available for this to work (set via syncGridSelection() or used by draggable grouping plugin)
  • Fallback to direct field access for DataView-only usage without grid reference

@ghiscoding
ghiscoding merged commit a0d1d01 into master May 6, 2026
6 checks passed
@ghiscoding
ghiscoding deleted the bugfix/data-item-value-extractor branch May 6, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grouping does not work with dataItemColumnValueExtractor

1 participant