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.
I know you who develop for Views are much smarter than I, but I thought I would offer this snippet as a suggestion that might help others if you deem it worthy.
I modified my Views grid tpl.php to say:
<tr class="<?php print $row_class; ?>">
<?php foreach ($columns as $column_number => $item): ?>
<?php
$col_class = 'col-' . ($column_number + 1);
if ($column_number == 0) {
$col_class .= ' col-first';
}
if (count($columns) == ($column_number + 1)) {
$col_class .= ' col-last';
}
?>
<td class="<?php print $col_class; ?>">
<?php print $item; ?>
</td>
<?php endforeach; ?>
</tr>
Instead of:
<tr class="<?php print $row_class; ?>">
<?php foreach ($columns as $column_number => $item): ?>
<td class="<?php print 'col-'. ($column_number + 1); ?>">
<?php print $item; ?>
</td>
<?php endforeach; ?>
</tr>
Nothing radical. I really just modified your existing row class assigning script to apply a similar 'first' and 'last' class to columns. In my case this was helpful in trying to set up a pixel perfect table in IE. Maybe others might appreciate the classes in the default template as well? I grant you, other still might say it is just bloat.
Thanks for Views!
Comment | File | Size | Author |
---|---|---|---|
#5 | snapshot10.png | 6.95 KB | dawehner |
#5 | 909332-grid-css-columns.patch | 759 bytes | dawehner |
#4 | 909332-grid-css-columns.patch | 1.29 KB | dawehner |
#1 | 909332-grid-css-columns.patch | 19.44 KB | dawehner |
Comments
Comment #1
dawehnerThere was a similar issue already: http://drupal.org/node/714836#new
But here is a patch for grid. There should be some planing.
Comment #2
dagmarThis patch includes Hybrid Filters...
Comment #3
dawehnerOh
Comment #4
dawehnerUpdate patch
Comment #5
dawehnerHere is a rerole
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedGuess this needs another reroll for D7 for some reason.
Comment #7
dawehnerAnd commited
Comment #9
dazz CreditAttribution: dazz commentedCould it be this isn't working anymore in Views 7.3.3?
I justed created a view with a table format i get something like
Comment #10
dawehnerI guess this was never added to 7.x-3.x