Table::Model manages data for Table controls.
CRITICAL MEMORY MANAGEMENT WARNINGS:
- Table::Model MUST be freed AFTER all Tables using it are destroyed
- Table::Model::Handler callbacks become invalid after Table::Model is freed
- DO NOT rely on GC/finalize for automatic cleanup - use explicit free()
- Avoid circular references in Table::Model::Handler callbacks
Safe usage pattern:
model_handler = Table::Model::Handler.new
model = Table::Model.new(model_handler)
table = Table.new(model)
... use table ...
table.destroy # Destroy table first
model.free # Then free model
Instance methods
append_checkbox_column(name : String, checkbox_model_column : Int32, editable : Int32 | ModelColumn) : Nil
Sourceappend_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable : Int32 | ModelColumn, text_model_column : Int32, text_editable : Int32 | ModelColumn, table_text_column_optional_params : TextColumnOptionalParams) : Nil
Sourceappend_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable : Int32 | ModelColumn, text_model_column : Int32, text_editable : Int32 | ModelColumn, color_model_column : Int32) : Nil
Sourceappend_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable : Int32 | ModelColumn, text_model_column : Int32, text_editable : Int32 | ModelColumn) : Nil
Sourceappend_image_column(name : String, image_model_column : Int32) : Nil
Sourceappend_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, editable : Int32 | ModelColumn, table_text_column_optional_params : TextColumnOptionalParams) : Nil
Sourceappend_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, editable : Int32 | ModelColumn, color_model_column : Int32) : Nil
Sourceappend_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, editable : Int32 | ModelColumn) : Nil
Sourceappend_progress_bar_column(name : String, progress_model_column : Int32) : Nil
Sourceappend_text_column(name : String, text_model_column : Int32, editable : Int32 | ModelColumn, table_text_column_optional_params : TextColumnOptionalParams) : Nil
Sourceappend_text_column(name : String, text_model_column : Int32, editable : Int32 | ModelColumn, color_model_column : Int32) : Nil
Sourceappend_text_column(name : String, text_model_column : Int32, editable : Int32 | ModelColumn) : Nil
editable can be :never, :always, or a model column whose values
control editability for each row.
Sourceclear_on_row_clicked
Clears the callback; equivalent to on_row_clicked(nil).
Sourceclear_on_row_double_clicked
Clears the callback; equivalent to on_row_double_clicked(nil).
Sourceclear_on_selection_changed
Clears the callback; equivalent to on_selection_changed(nil).
Sourcecolumn_set_width(column : Int32, width : Int32) : Nil
Sourcecolumn_width(column : Int32) : Int32
Sourceeach_selected_index
Yields each selected row index without copying the native row array into
a Crystal Array. The native selection snapshot is freed after iteration,
including when the block raises. Use selection to retain a snapshot.
Sourceheader_set_sort_indicator(column : Int32, sort_indicator : SortIndicator) : Nil
Sourceheader_sort_indicator(column : Int32) : SortIndicator
Sourceon_row_clicked(callback : Nil) : Nil
Sourceon_row_double_clicked(callback : Nil) : Nil
Sourceon_selection_changed(callback : Nil) : Nil
Sourceselection=(selection : Selection) : Nil
Sourceselection_mode=(mode : Selection::Mode) : Nil
Source