The Row Auto Size Plugin enhances RevoGrid by automatically calculating and adjusting row heights based on their content. This ensures optimal display of data, particularly useful for cells containing multi-line text, rich content, or varying amounts of information.
When the plugin is enabled, normal grid cells wrap text so the rendered content matches the height calculation. Row heights are recalculated from the wrapped content after source changes, edits, scrolling into new virtual rows, configuration changes, and manual column resizing.
Automatic Height Calculation: Dynamically adjusts row heights based on
content. - Content-Aware: Considers line breaks, text wrapping, and column
widths. - Resize-Aware: Recalculates visible row heights after manual
column resizing. - Configurable Limits: Set minimum and maximum heights to
maintain consistency. - Custom Calculator Support: Implement your own
height calculation logic. - Efficient Caching: Caches calculated heights
to optimize performance. - Precise Mode: Optional precise calculations
using DOM measurements.
The plugin is designed with performance in mind, but there are some considerations:
Precise Mode: Using preciseSize: true provides more accurate calculations but is slower as it requires DOM operations.
Precalculation: In non-precise mode, precalculate is enabled by default. The plugin warms row height cache in chunks so rows already have a height when they are scrolled into view.
Batch Size: precalculateBatchSize controls how many rows are processed per animation frame. Larger values warm the cache faster but make each frame heavier.
Large Datasets: For very large datasets, set precalculate: false to calculate only visible rows and preserve demand-driven behavior.
Custom Calculators: When implementing a custom calculator, ensure it’s efficient as it will be called frequently during scrolling.
The Row Auto Size Plugin provides a powerful solution for handling varying content heights in RevoGrid. By automatically adjusting row heights while maintaining performance, it significantly improves the presentation and usability of your grid, especially when dealing with dynamic or rich content.