Tutorials & Examples
Basic Example
A simple VitalGrid demonstration with essential features like sorting, filtering, and column resizing.
Basic Example
A simple table demonstrating essential features: sorting, filtering, column resizing, and basic data types.
Features Demonstrated
- Sorting: Click column headers to sort data ascending or descending
- Filtering: Use filter inputs to search and filter data by column
- Column Resizing: Drag column borders to adjust column widths
- Data Types: Text, number, and status field types
- Column Reordering: Drag and drop columns to reorder them
Code Structure
The BasicExample shows the fundamental pattern for using VitalGrid:
- Factory Creation: Create a VitalGrid factory with desired features
- Data Definition: Define your sample data array
- Column Configuration: Set up column definitions with types and settings
- Grid Hook: Use the
useVitalGridhook to create the grid instance - Rendering: Render the grid using the Provider and component structure
Key Concepts
- Factory pattern prevents component recreation and improves performance
- Column definitions specify data types, validation, and display settings
- The Provider component manages grid state and workspace persistence
- Component structure (Root, Toolbar, Header, Body) provides a flexible layout
This example serves as the foundation for understanding more complex VitalGrid implementations.