Hello,
in one of my views, I use the "grid"-style (3 columns - no grouping - horizontal). The view is used for an online gallery that has changing numbers of pictures.
I center images in each box of the grid with css.
Since the update to views 6.x-2.10 I have the following problem:
If the view has only one image, this image is displayed centered of the whole view width: === =X= ===
Before the update of views, it was correctly centered in the left "grid box" (grid with 3 columns): =X= === ===
Looking at the source code of the view output, I see the following:
<div class="view-content">
<table class="views-view-grid">
<tbody>
<tr class="row-1 row-first row-last">
<td class="col-1">
... content ...
</td>
</tr>
</tbody>
</table>
</div>
The problem seems to be that there are no <td></td> for the 2 empty columns of the row. I think there were some before the update?
Has something been changed with the grid style? Is there a new setting somewhere?
It would be very good if an existing row could be filled with empty <td></td> to style it easier...
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 768162-fill_single_row-configurable.patch | 1.69 KB | dawehner |
| #13 | 768162-fill_single_row-configurable.patch | 1.69 KB | dawehner |
Comments
Comment #1
dawehnerThis was a feature request. To get back the old behavior, you need this preprocess code:
Comment #2
merlinofchaos commentedHmm? I thought the feature request was to *ensure* that we had tds? Because without the tds the grids look odd. :/
Maybe we need to make it a switch.
Comment #3
dawehnerPerhaps this should be configurable?
Comment #4
MJH commentedThanks for your answers.
I already found the source of my problem:
http://drupal.org/node/451208
Patch in #24, committed to all branches
I revoked the patch and everything works normally again.
===
It seems that the new patch
- does include empty
<td></td>if there is more than one row- does NOT include empty
<td></td>if there is only one rowHaving empty
<td></td>makes it a lot easier to theme the grid view. And the<td></td>should not cause any problems (nothing that could not be hidden with css).So they should be there even if the grid view has only one row... (my opinion)
Comment #5
dawehnerSo you want to make it configurable.
On earlier days views 2.0, for example, this feature didn't exist at all, the rows wasn't poluted
Comment #6
merlinofchaos commentedHm. Ok, no, in that case the issue is that the behavior is inconsistent. Every row should always have a full column's worth of tds. Maybe that patch I committed was simply wrong.
Comment #7
dawehnerI think it was a valid feature request. I think there are two different kind of use cases.
Comment #8
merlinofchaos commentedPerhaps, but feature requests that change basic behavior must be weighed carefully, lest this happen. I didn't understand clearly enough what was wrong, I somehow though the patch had an error when there was only one row.
Comment #9
dawehnerWe need better/more communication
Comment #10
jwaxman commentedWhat happened with this?
Is it going back to the old way (empty tds)?
If not, is there a way to get around this with CSS?
I, like a lot people, I guess, have a gallery of thumbnail photos laid out as a grid.
If there are fewer then a row's worth of thumbnails, they distribute themselves over the width of the table rather than lining up to the left the way I'd like.
Specifying fixed-layout and specifying percentage column widths in the td tags doesn't work to fix this.
Thanks
Comment #11
merlinofchaos commentedThis needs to go back to the old way. Sorry for letting it drop. I'll deal with it this week.
Comment #12
jwaxman commentedMany thanks.
Comment #13
dawehnerHere is a patch which reverts the default behavior and make it configurable. So by default all columns gets displayed
Comment #14
dawehnerUpdate to minimal code style issue(whitespaces)
Comment #15
merlinofchaos commentedCommitted. I, er, accidentally committed #13 though. What was the actual diff between #13 and #14? My eyes aren't picking it out.
Comment #16
tim.plunkettIn #13, line 17 of the patch introduced trailing whitespace, so now line 44 of plugins/views_plugin_style_grid.inc has trailing whitespace.