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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

There was a similar issue already: http://drupal.org/node/714836#new

But here is a patch for grid. There should be some planing.

dagmar’s picture

This patch includes Hybrid Filters...

dawehner’s picture

Assigned: Unassigned » dawehner

Oh

dawehner’s picture

Status: Needs work » Needs review
FileSize
1.29 KB

Update patch

dawehner’s picture

Here is a rerole

merlinofchaos’s picture

Version: 6.x-2.11 » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

Guess this needs another reroll for D7 for some reason.

dawehner’s picture

Status: Patch (to be ported) » Fixed

And commited

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dazz’s picture

Status: Closed (fixed) » Active

Could 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

<tr class="odd views-row-first">
  <td class="views-field views-field-name"></td>
  <td class="views-field views-field-field-item-id active"></td>
</tr>
dawehner’s picture

I guess this was never added to 7.x-3.x