TableModel

Base class for models of Table.

Header#include "nativeui/table_model.h"
Namespacenamespace nu
Typeclass (RefCounted)

Users can implement a subclass of TableModel to feed Table any kind of data source. It is required to call the Notify methods in subclasses when data has been changed, so the Table can correctly update.

For simple use cases, the SimpleTableModel can be used.

Methods

uint32_t GetRowCount() const

Return how many rows are in the model.

This is a pure virtual method, subclass must override this method.

Return

uint32_t

const base::Value* GetValue(uint32_t column, uint32_t row) const

Return the reference to the data at column and row.

Caller should not store the return value, as it is a temporary reference that may immediately get destroyed after exiting current stack.

This is a pure virtual method, subclass must override this method.

Parameters

Return

const base::Value*

void SetValue(uint32_t column, uint32_t row, base::Value value)

Change the value at column and row.

This is a pure virtual method, subclass must override this method.

Parameters

void NotifyRowInsertion(uint32_t row)

Called by implementers to notify the table that a row is inserted.

Parameters

void NotifyRowDeletion(uint32_t row)

Called by implementers to notify the table that a row is removed.

Parameters

void NotifyValueChange(uint32_t column, uint32_t row)

Called by implementers to notify the table that the value at column and row has been changed.

Parameters