DVUI

GridWidget

A scrollable grid widget for displaying tabular data. Also known as a table, TableWidget for grepping purposes. Features:

  • Optional headers.
  • Consistent or variable row heights.
  • Horizontal and vertical scrolling.
  • Individual cell styling.

If row_height_variable is false, rows and columns can be laid out in any order, including sparse layouts where not all rows or columns are provided.

If row_height_variable is true, rows must be laid out sequentially—either:

  1. All rows for a column before moving to the next column, or
  2. All columns for a row before moving to the next row.

See also:

  • CellStyle: helpers to style grid cells and widgets.
  • HeaderResizeWidget: draggable header resizing.
  • VirtualScroller: virtual scrolling through large datasets.

Fields

#
vbox:BoxWidget
BoxWidget
header_group:dvui.FocusGroupWidget

SAFETY: Set by headerScrollAreaCreate, is valid when hscroll is non-null

body_group:dvui.FocusGroupWidget

SAFETY: Set by bodyScrollAreaCreate, is valid when bscroll is non-null

scroll:ScrollAreaWidget
ScrollAreaWidget
hscroll:?ScrollAreaWidget
?ScrollAreaWidget
bscroll:?ScrollContainerWidget
?ScrollContainerWidget
hsi:ScrollInfo
ScrollInfo
bsi:*ScrollInfo

might point to default_scroll_info

frame_viewport:Point

SAFETY: Set in install

col_widths:[]f32
[]f32
starting_col_widths:?[]f32
?[]f32
resizing:bool
bool
header_height:f32
f32
last_row_height:f32
f32
sort_direction:SortDirection
SortDirection
sort_col_number:usize
usize
default_scroll_info:ScrollInfo
ScrollInfo
cols:WidthsOrNum
WidthsOrNum
row_height:f32
f32
max_row:usize
usize
cur_row:usize
usize
rows_y_offset:f32
f32
next_row_y:f32
f32
this_row_y:f32
f32
last_header_height:f32
f32
rows:std.array_hash_map.Auto(usize, dvui.Id)
std.array_hash_map.Auto(usize, dvui.Id)
init_opts:InitOpts
InitOpts

Types

#
VirtualScroller

Provides vitrual scrolling for a grid so that only the visibile rows are rendered.

HeaderResizeWidget

Provides a draggable separator between columns

KeyboardNavigation

Adds keyboard navigation to the grid

Functions

#
headerCell

Create a header cell for the requested column

bodyCell

Create a body cell for the requested column and row

offsetRowsBy

Set the starting y value in the scroll container to begin rendering rows.

pointToBodyRelative

Converts a physical point (e.g. a mouse position) into a logical point

pointToCell

Convert a screen physical coord into a grid cell position.

colSortSet

Set the grid's sort order when manually managing column sorting.

sortChanged

For automatic management of sort order, this must be called whenever

colSortOrder

Returns the sort order for the current column.

colWidth

Returns the width of the requested column

colWidthSet

Sets the column width of the requested column, only if the user didn't

posX

Returns the x position of the requested column

totalWidth

Returns the total width of all columns

Constants

#

Variables

#

Aliases

#
CellStyle

Provides cell options and widget options for grid cells.