Documentation
Row Grouping
Row grouping allows you to organize your data into expandable hierarchical structures, making it easier to navigate large datasets with natural parent-child relationships.
Basic Setup
To enable row grouping, add the expandable: true property to your column header, structure your data with nested arrays, and specify the grouping hierarchy.
💡 Use Cases
- Organize teams by department and show individual members
- Display projects with their milestones and tasks
- Show product categories with subcategories and items
- Group transactions by account, invoice, and line items
Row Grouping Configuration
Programmatic Control
Version 2.1.0 introduces powerful programmatic control over row grouping expansion. You can now control which hierarchy levels are expanded or collapsed using the table ref API. These methods give you fine-grained control over the visibility of nested data.
🎯 New Table API Methods (v2.1.0)
expandAll()- Expand all rows at all depthscollapseAll()- Collapse all rows at all depthsexpandDepth(depth)- Expand all rows at a specific depth (0-indexed)collapseDepth(depth)- Collapse all rows at a specific depth (0-indexed)toggleDepth(depth)- Toggle expansion for a specific depthsetExpandedDepths(depths)- Set which depths are expanded (replaces current state)getExpandedDepths()- Get currently expanded depths as a SetgetGroupingProperty(depth)- Get the grouping property name for a depth indexgetGroupingDepth(property)- Get the depth index for a grouping property name
Dynamic Row Loading
For large datasets, use the onRowGroupExpand callback to load nested data on-demand. This example demonstrates a three-level hierarchy (Regions → Stores → Products) where child rows are fetched from an API only when their parent is expanded. The callback provides powerful helper functions like setLoading, setError, and setEmpty for state management, plus rowIndexPath for easy nested data updates.
💡 Benefits
- Faster initial load - only top-level rows are fetched
- Reduced memory usage - child data loaded as needed
- Better performance with large hierarchical datasets
- Seamless integration with server-side APIs
- Built-in state management with setLoading, setError, and setEmpty helpers
- Simple nested data updates using rowIndexPath array