Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Some example pages with tables:
- Issue queues: https://sprint5-drupal.redesign.devdrupal.org/project/issues
- Project pages: https://sprint5-drupal.redesign.devdrupal.org/project/drupal
- User posts pages: https://sprint5-drupal.redesign.devdrupal.org/user/1/track
- Blocks on user dashboard: https://drupal.org/user/X/dashboard
- Files table on release page: https://drupal.org/node/1965242
- Usage statistics: https://drupal.org/project/usage/views
- Forum https://drupal.org/forum
Test instructions
The latest patch is a complete proof of concept solution for the issue queue table (the beast of all tables).
Please go to this url on a small screen .../project/issues/drupal?categories=All and give feedback below.
Comment | File | Size | Author |
---|---|---|---|
#20 | bluecheese-2225355-tables-20.patch | 4.74 KB | emma.maria |
#19 | Screenshot 2014-03-28 14.42.53.jpg | 127 KB | LewisNyman |
#19 | Screenshot 2014-03-28 14.36.33.jpg | 100.88 KB | LewisNyman |
#16 | Issues for Drupal core sprint11 drupal dev.png | 643.78 KB | emma.maria |
#16 | bluecheese-2225355-tables-16.patch | 4.63 KB | emma.maria |
Comments
Comment #1
sqndr CreditAttribution: sqndr commentedTables are a real challenge to make responsive. Because the tables might be really big, I assume there are a few techniques that we could apply.
Comment #2
sqndr CreditAttribution: sqndr commentedComment #3
Manuel Garcia CreditAttribution: Manuel Garcia commentedLewis mentioned we should get together tomorrow morning to talk about this, figure out the best way to approach this.
Comment #4
sqndr CreditAttribution: sqndr commentedYeah, I created the issue and Lewis told me that there was going to be a discussion to find best approach. We'll figure it out tomorrow. If we'd go for a table flip, a table could look like this (did a small implementation - so, far from perfect - where the table is scrollable):
Comment #5
thamashttps://drupal.org/project/responsive_tables was mentioned by Dave Reid in the preceding issue #1599128: Responsive Table Solution
Comment #6
emma.mariaInstead of trying to get a table layout to work on smaller screens we should consider restructuring the data to be more readable.
My company has used this on a few sites http://johnpolacek.github.io/stacktable.js/ and it turns a table row into a vertical list with headings.
I was looking on Drupal.org and you can see this technique is already used on the user dashboard page to save space. https://drupal.org/user/*/dashboard
Comment #7
sqndr CreditAttribution: sqndr commentedGetting back to my first comment, the solution above would be option 2 from my first comment, were we display a table as a block. Kinda 'easy' for when there are no table headings, but the real challenge here is when there a table headings. You'd have to repeat those for every block as well. As an example:
A B C D
1 2 3 4
Z X Y W
would become:
A 1
B 2
C 3
D 4
A Z
B X
C Y
D W
So I think you'd have to repeat those heading, unless I'm missing something here?
Comment #8
thamas#6 looks to be a nice solution and works well with table headers as it can be seen at the project page
Comment #9
sqndr CreditAttribution: sqndr commentedAh - yeah, sorry. I did miss something! ;)
Comment #10
emma.mariaHere is also a working version of #6 and #7 http://codepen.io/geoffyuen/pen/FCBEg
Comment #11
emma.mariaComment #12
LewisNymanI hacked away at the views table plugin and this patch now adds data-th attributes to all table cells in views :) We would still need to do more stuff to get the same for non-views tables but this is a good start.
Comment #13
emma.mariaNice one, I am adding a small bit of JS and CSS for it now \o/
Comment #14
tvn CreditAttribution: tvn commentedAdded some more examples of pages with tables.
Comment #15
emma.mariaAdded JS to calculate when the responsive tables should kick in depending on the width of the table. A class is added when the table width hits equal to or more than the screen width. The CSS (the nice easy bit) will join later tonight.
Comment #16
emma.mariaPatch updated and complete, test away!
Comment #17
emma.mariaComment #18
emma.mariaComment #19
LewisNymanFound a problem with the project usage page, you can probably just remove some CSS for mobile to get it looking ok https://sprint5-drupal.redesign.devdrupal.org/project/usage/views
Forums also look weird
Comment #20
emma.mariaFixes added:
- Disabled responsive tables here https://sprint5-drupal.redesign.devdrupal.org/project/usage/views and on .../forum until data attributes can be added.
- Wrong colours on pink issue status boxes.
- Issue queue roq fixes : added styles for project name and changed first cell to have bold styles rather than specific content.
- Removed whitespace error.
Comment #21
LewisNyman