Skip to content

Feature: Allow to Persist table state (column order/width/visibility, sorting, filtering)#387

Open
DanielTrommel wants to merge 1 commit into
w-ahmad:mainfrom
DanielTrommel:feature/persist-user-state
Open

Feature: Allow to Persist table state (column order/width/visibility, sorting, filtering)#387
DanielTrommel wants to merge 1 commit into
w-ahmad:mainfrom
DanielTrommel:feature/persist-user-state

Conversation

@DanielTrommel

@DanielTrommel DanielTrommel commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@w-ahmad Usability feature that I needed myself, and wanted to share, as probably more people may like to use this.

This PR adds

  • a StateChanged event,
  • a State get/set property to the TableView;
    • state includes all things the user can influence at runtime; column order, sorting,
  • which interacts with a Helper to get/set the current column/sorting/filtering state in/from a State object
  • that state object can be used to store to e.g. the AppSettings, using the JsonSerializer

Notes

  • Designed to be opt-in, and minimal changes to existing code.
  • the state setting code is forgiving; best effort processing (persisted state could (partially) mismatch after column changes by developer)
  • matching is done for bound columns based on path (Tag is secondary, when multiple matches); for template columns the Tag/Name is used.

Column Visibility

Note that this State also includes "Visibility"; I don't think we have functionality yet to hide columns in a built-in fashion, do we?
I would love to add this as well, as with this PR it would allows users to modify a column, and persist their preferred order and visibility etc.

New Column

Furthermore, I would think these are great additionals to runtime configurability:

  • We could allow (totally new!) columns to be added at runtime; based on the associated (abstract) type in the CollectionView, we could create a dialog where users choose a property to add a new column, and then obviously persist those across sessions. (This could be even more advanced, by using reflection to `walk' the model and choose a binding path)
  • In addition, it would then also be good to allow columns to be renamed (the default property name might not do the functional context justice)

Grouping

Also the Grouping feature (this PR: #340) would be excellent to be end-user configurable (out-of-the-box), and persist-able. Of course the developer could set a default, but we could allow to change the grouping column via a context menu on the header of a column.
I hope you will consider to merge your implementation of the grouping 🙏, as it seems functionally very valuable have.

Signed-off-by: Daniël Trommel <d.s.trommel@gmail.com>

Persist the table state wrt to runtime (user) influenced parts: column order/width/visibility, sorting, filtering
@DanielTrommel

Copy link
Copy Markdown
Contributor Author

PS: to avoid merge conflicts with at least one other PR is saw, I added my new code somewhere sensible, but not at the end of existing files.

@DanielTrommel

Copy link
Copy Markdown
Contributor Author

Just realized that TableView.FrozenColumnCount could also be a candidate to configure at runtime, and part of the state.
More properties like that?

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