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.
A common desire with the grid style is to have columns display with equal widths to have a nice even grid. Table cells expand depending on their content, so if you have, say, different lengths of node titles in your results, it can get uneven easily.
The td tags have column counts on them, but there's no way to generically know how many columns are in a table, unless you target the specific view. If the table tag had a class like "cols-4" on it, it would be easy to do a table.cols-4 td { width: 25%; }
to even out the columns.
Comment | File | Size | Author |
---|---|---|---|
#9 | views_table_cols_count.png | 43.63 KB | dboulet |
#7 | views-DRUPAL-6--2_table_cols_class.patch | 1.42 KB | dboulet |
#1 | views-672864.patch | 342 bytes | dawehner |
Comments
Comment #1
dawehnerHere is a patch. If this patch is not accepeted you can still do this same in your own theme_preprocess_views_view_table
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedSimple enough. Committed to all branches.
Comment #4
doublejosh CreditAttribution: doublejosh commentedNice. Been wanting to suggest this for a while. Can't wait for it to get into the next release.
Comment #5
doublejosh CreditAttribution: doublejosh commentedThis seems to have been a patch for table style not grid style. Suppose the table one needed it too :)
Thought I could add this to line 470, but it seems $vars['classes'] is not used on this preprocess function?
Comment #6
dawehnerShouldn't be this part of http://drupal.org/node/714836 ?
Comment #7
dboulet CreditAttribution: dboulet commentedWhy are we counting rows to generate a class called "cols"? The patch that was committed doesn't facilitate the requested feature at all.
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commenteddereine, can you look at this? I remember seeing something like this when I was messing with semantic views patch, and it felt like the cols- counting in general was counting rows, not columns, but I'm not totally sure.
Comment #9
dboulet CreditAttribution: dboulet commentedIt's definitely counting rows.
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedBecause of the semantic views patch I suspect we need separate patches for 2.x and 3.x
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted fix to all branches.