Status: Complete
Task: T17
Overview
This guide provides step-by-step instructions for migrating existing table implementations to the new@/platform/table DataTable framework.
Quick Start
1. Add Imports
2. Define Columns
3. Use the Hook
4. Render Components
Migration Patterns
Pattern 1: Basic Table with Loading/Empty States
BEFORE:Pattern 2: Table with Search and Filters
BEFORE:Pattern 3: Row Actions Menu
BEFORE:Pattern 4: Status Badges
BEFORE:Pattern 5: Currency Formatting
BEFORE:Pattern 6: Date Formatting
BEFORE:Pattern 7: Pagination
BEFORE:Pattern 8: Row Selection with Bulk Actions
BEFORE:Common Gotchas
1. Column Key Must Be Unique
2. Accessor Must Return Sortable Value
3. Remember filterable: true for Searchable Columns
4. Use hideOnMobile for Non-Essential Columns
5. Custom Render Must Handle Null/Undefined
Step-by-Step Migration Checklist
For each table file:Preparation
- Review current implementation
- Identify all features (filters, sorting, pagination, actions)
- Note any custom rendering
Migration
- Add imports from
@/platform/table - Define
Column<T>[]array - Map existing TableHead elements to columns
- Add
typefor currency/date/boolean columns - Add
filterable: truefor searchable columns - Add
hideOnMobile: truefor non-essential columns - Move row actions to column render function
- Replace filter state with
useDataTablehook - Replace
<Table>with<DataTable> - Add
TableFilterscomponent if filters exist - Add
TablePaginationcomponent if pagination needed - Add bulk actions if selection exists
Testing
- Verify loading state shows skeleton
- Verify empty state displays correctly
- Verify filtering works (global + column)
- Verify sorting works
- Verify pagination works
- Verify row actions work
- Verify mobile responsiveness
- Verify accessibility (keyboard navigation)
Cleanup
- Remove unused imports
- Remove duplicate utility functions
- Update component props if simplified
Need Help?
- DataTable API: See
src/platform/table/README.md - Column Types: See
src/platform/table/types.ts - Examples: See existing platform tables
- Issues: Document in migration audit file