Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement FlexTable to be reactive to data changes and synthesise cell widgets at runtime #129

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

atlanticaccent
Copy link
Contributor

@atlanticaccent atlanticaccent commented Apr 29, 2024

This PR reworks FlexTable to operate similarly to List.

We introduce two new traits similar to ListIter: TableData and RowData, both of which have Data as a supertrait. FlexTable is now only implemented over types implementing TableData.

The required methods of TableData are such that we can trivially implement a FlexTable over a simple continuous container that will display all rows and cells constantly. However, they also allow us the flexibility to arbitrarily change the order of rows based on the underlying data, or to choose not to render rows - both by changing what is actually returned by the keys method.

Widgets are generated by calling on the cell method of RowData - as it is not a significant design burden a reference to the implementing data structure is provided so that the generated Widget can include constants derived from the current state of the data if it so chooses.

Some compromises are made to preserve the existing "fixed" functionality, where all rows and cells are provided up front. This is reimplemented in the FixedTable and FixedRow data types.

Todo:

  • More documentation
  • Possible remove Index/IndexMut supertrait requirements on TableData and require get_row/get_row_mut methods instead
  • Possibly keep the "old", non-reactive version of FlexTable as FlexTable, and name the new implementation ReactiveFlexTable or DataFlexTable, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant