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

Make table rows sortable #3483

Open
marcoscaceres opened this issue Apr 26, 2021 · 8 comments · May be fixed by #3812
Open

Make table rows sortable #3483

marcoscaceres opened this issue Apr 26, 2021 · 8 comments · May be fixed by #3812

Comments

@marcoscaceres
Copy link
Member

Is your feature request related to a problem? Please describe.
When there is a big table...

Describe the solution you'd like
It would be nice for big tables to sort by column.

@sidvishnoi
Copy link
Member

sidvishnoi commented Apr 26, 2021

Like on a button/header click or as a pre-process step?

@marcoscaceres
Copy link
Member Author

@sidvishnoi, see w3c/did-spec-registries#273 ... but will try to get clear requirements from there.

I think we might want dynamic (click-based), not preprocessed... so including another .runtime.

@iherman
Copy link
Member

iherman commented Apr 26, 2021

Some thoughts on requirements:

  • Sort should be on the text content of the <td> elements and not on (HTML) elements. Sounds obvious, but I saw simple tools that, when sorting, did sorted <a href="...">XYZ</a> before <b>ABC</b>...
  • Probably also obvious, but sorting means only on rows with within a <tbody> section, not on <thead> section. If there are several <thead> elements then... I would think that the corresponding <tbody> elements are sorted independently of the others, ie, every <thead> - <tbody> pair is a separate "sorting context". But opinions may differ on this.
  • I am not sure what to do with a simple table without the <thead>-<tbody> pairs. I would not be shocked if those tables could not be sorted :-)
  • The user should have a possibility to choose between ascending and descending order (usually through either a choice in the header using some icons, or by repeatedly clicking on the header).
  • Whether a table is sortable or not could be controlled, e.g., by special classes.
  • Bonus feature: possibility to automatically cut a large table to smaller chunks (say, 10 entries) and move from one chunk to the other via some extra user interface. (This is a bonus feature, ie, it may not be a requirement in the first round.)

@TallTed
Copy link
Member

TallTed commented Apr 27, 2021

@iherman covered all the requirements I was about to write, and a few I hadn't thought of just now (though similar have bitten me in the past). Having these features available will be of great benefit to many spec contributors/authors/editors/etc.

@gkellogg
Copy link
Member

While you're in there: I've had requests for floating column heads, so that for large tables with many columns, you can always see the column title.

@marcoscaceres
Copy link
Member Author

Ah, yeah. We should make those "sticky" - good suggestion @gkellogg. We can probably prototype that here and then push the CSS to the /tr-design repo.

@iherman
Copy link
Member

iherman commented Feb 25, 2022

Just wondering whether there are some thoughts about the timing of this feature request...

@marcoscaceres
Copy link
Member Author

@sidvishnoi created a draft #3812. I wonder if we could release that as an MVP and build it up over time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Up next
  
Prioritized
Development

Successfully merging a pull request may close this issue.

5 participants