Skip to content

Update grades_-/staff_semester_view to css grid - #2748

Draft
fekoch wants to merge 3 commits into
e-valuation:mainfrom
fekoch:2352/css-grid
Draft

Update grades_-/staff_semester_view to css grid#2748
fekoch wants to merge 3 commits into
e-valuation:mainfrom
fekoch:2352/css-grid

Conversation

@fekoch

@fekoch fekoch commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Refactors the DataGrid class to provide different factory functions for different HTML representations of the tables.

Updates the tables in:

  • grades_semester_view.html
  • staff_semester_view.html

@fekoch fekoch changed the title Update grades_-/staff_semester_view toö css grid Update grades_-/staff_semester_view to css grid Jun 22, 2026
@fekoch
fekoch force-pushed the 2352/css-grid branch 2 times, most recently from ff3544f to d9846fe Compare June 22, 2026 20:43
@niklasmohrin

Copy link
Copy Markdown
Member

There are still TODOs in the code. Is there something that we should already look at?

@fekoch

fekoch commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

There are still TODOs in the code. Is there something that we should already look at?

Good point, I overlooked those. Something, something self review....

Still, @niklasmohrin I would appreciate a review. Resolving the TODOs should only result in a minimal diff. (I switched it to draft anyway.)

@fekoch
fekoch marked this pull request as draft June 29, 2026 19:23
@fekoch
fekoch force-pushed the 2352/css-grid branch 2 times, most recently from f09c01d to 31a0c75 Compare July 6, 2026 19:53
Comment thread evap/static/ts/src/datagrid.ts Outdated
Comment on lines +47 to +48
protected readonly filterButtons: HTMLButtonElement[] = [];
protected readonly resetFilterButton?: HTMLButtonElement;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no one is providing any value for these two attributes, right?

Comment on lines +68 to +69
for (const orderElement of headerContainer.querySelectorAll<HTMLElement>(".col-order")) {
sortableHeaders.set(orderElement.dataset.col!, orderElement);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in old version, but: Why are we not querying for [data-col] here?

private searchInput: HTMLInputElement;
protected readonly resetSearch?: HTMLButtonElement;
protected rows: Row[] = [];
export class DataGrid {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the base data grid is now even more complicated and the responsibilities are less clear. I wonder if there is some way to decompose the responsibilities into more modules/classes. Intuitively, I would say that we have
a) sorting of rows b) filtering of rows c) save and restore of state d) mirroring internal state to the DOM. These responsibilities are somewhat intertwined though.

Maybe one possible way to split this is to have one class that does all the sorting, filtering, state management, but does not interact with the DOM, and another class drives an instance according to what users to in the DOM. Not sure though.

@niklasmohrin

Copy link
Copy Markdown
Member

Discussion today:

  • CSS grid is not as great as we think, but we still want it in favor of tables for more flexible sizing
  • we want to have table grid functionality in base datagrid, but the code is rather convoluted
  • we want to refactor datagrid to separate concerns (filtering, sorting, rendering, initialization), perhaps with a factory function and by attaching several Filter instances to a grid; filters are tied to DOM elements and tell the grid to update, the grid re-renders itself
  • long term: all filters fetch their range of possible values from the data in the DOM and create html inputs accordingly (similar to RangeSlider's includeValues today); edit: nevermind, we want to keep the chosen order of, for example, course types as in the database, and the dom doesn't know about that
  • we develop this new data grid in parallel to the current data grid to avoid having a huge PR that changes all grids; this way, we can port HTML to CSS grid and js to new datagrid at once without doing everything in one huge PR

fekoch and others added 3 commits August 3, 2026 18:30
Refactors the DataGrid class to provide different factory functions for
different HTML representations of the tables.

Signed-off-by: Felix Koch <dev@felixkoch.at>
Signed-off-by: Felix Koch <dev@felixkoch.at>
Signed-off-by: Felix Koch <dev@felixkoch.at>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants