This is a fairly benign issue but I thought I would mention it as it will prove frustrating if it pops up out of the blue.

I have a view block that uses a Grid format with 4 columns and a set of filters that will display anywhere from 2 to 32 items. The Grid settings are default except for being 4 columns wide.

The issue is that although the table is set to have 4 columns, if the number of items to return are less than 4 (ie: 2) the table will only produce that number of columns. In my case one filter produces two items so the table that was set to span 100% with 4 td elements with widths of 25% ended up a table at 100% and only 2 td elements. Not the end of the world and I was able to adjust the CSS stylesheet to make up for it but this is a different behaviour from the 7–3.3 version and may trip someone else up.

Comments

Yes, it seems several people are having problems with some of the settings being undone during the upgrade from 3.3 to 3.4. You might refer to these other two issues and close this one if any of that information helps solve your problem. These two issues below may not be exactly the same as what you are facing, but they could be related.

Update to 7.x-3.4 un-sets the boolean operator in filters

Upgrade is cancelling boolean operator settings

Nope, different issues. I commented on those when I ran across those last night and resolved them in one of my sites.

This is entirely an issue with the way the HTML for the table is outputted and I believe 7.x–3.4 ignores the checkbox setting for "Fill up single line" which is on in this case and on by default.

Well 7.x–3.5 is out and fixes the boolean bug but the Grid view is still not outputting the correct number of TD's.

@dawehner: Do you think so? I'm not sure that it is.

This is a new behavior that only began with the 7.x–3.4 / 7.x–3.5 updates. 7.x–3.3 was outputting the correct number of TD elements regardless whether there was data or if they were empty cells.

Thanks,
Andrew

Title:Update from 7.x–3.3 to 7.x–3.4/7.x-3.5 : Grid format disregards preset number of columns Update from 7–3.3 to 7–3.4; Grid format disregards preset number of columns
Version:7.x-3.5» 7.x-3.4
Component:User interface» Miscellaneous
Assigned:Ace Cooper» Unassigned
Status:Needs review» Active
StatusFileSize
new56.21 KB

Happens to me as well - Views 3.5 ignores the "Fill the last row" setting for a single row.
To better demonstrate it, see some screenshots:
1. Views respects "Fill up last row" setting when there are several rows.
2. Views ignores "Fill up last row" setting with only single row of results.

Yes, the second JPG illustrates exactly the issue I ran into. The outputted code should generate a table with 4 TD elements but only generates 2 which forced me to go in and change the CSS as a temporary work-around.

The code difference is as follows:

<!-- correct output with Views 7.x–3.3 -->
<table class="views-view-grid cols-4">
  <tbody>
<tr class="row-1 row-first row-last">
      <td class="col-1 col-first">
          <!-- A series of fields depicting content -->
      </td>
      <td class="col-2">
          <!-- A series of fields depicting content -->
      </td>
      <td class="col-3">    </td>
      <td class="col-4 col-last">    </td>
    </tr>
  </tbody>
</table>

<!-- Incorrect output with Views 7.x–3.4 / 7.x–3.5 -->
<table class="views-view-grid cols-4">
  <tbody>
<tr class="row-1 row-first row-last">
      <td class="col-1 col-first">
          <!-- A series of fields depicting content -->
      </td>
      <td class="col-2 col-last">
          <!-- A series of fields depicting content -->
      </td>
    </tr>
  </tbody>
</table>

Title:Update from 7–3.3 to 7–3.4; Grid format disregards preset number of columns Update from 7.x–3.3 to 7.x–3.4/7.x-3.5 : Grid format disregards preset number of columns
Version:7.x-3.4» 7.x-3.5
Component:Miscellaneous» User interface
Assigned:Unassigned» Ace Cooper
StatusFileSize
new529 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

To make Views correctly fill up a single row I edited the views/theme/theme.inc line 692 (Views 3.5):

// Fill up the last line only if it's configured, but this is default.
      if (!empty($handler->options['fill_single_line']) && count($rows)) {
and changed it to:
// Fill up the last line only if it's configured, but this is default.
      if (!empty($handler->options['fill_single_line'])) {

Attached below you will find a simple patch for this feature. Voilà!

P.S. "If you want something done well - do it yourself" Mr.Zorg, 5th Element.

Status:Active» Needs review

edit: nevermind...

Title:Update from 7–3.3 to 7–3.4; Grid format disregards preset number of columns Update from 7.x–3.3 to 7.x–3.4/7.x-3.5 : Grid format disregards preset number of columns
Version:7.x-3.4» 7.x-3.5
Component:Miscellaneous» User interface
Assigned:Unassigned» Ace Cooper
Status:Active» Needs review

Patch from #8 works for me!
Thanx!

Title:Update from 7.x–3.3 to 7.x–3.4/7.x-3.5 : Grid format disregards preset number of columns Grid format disregards "number of columns" option for a single line of results
Status:Needs review» Fixed

Changed title to better describe the problem and closed the issue.

I dropped the version description:
Update from 7.x–3.3 to 7.x–3.4/7.x-3.5
since version is tagged within issue.

I can not imagine a case, where we would like an item from single line of results have a different width than items from multiple lines.
If someone can produce such a usecase - feel free to reopen this issue and we will have to add a corresponding checkbox to the grid formater options.

@Ace Cooper: Thanks for adjusting the title and putting together the patch in #8 but shouldn't we keep the issue open until it has been committed to the next views update?

Status:Fixed» Needs review

If you don't wish to work on the issue please unassign yourself, but this has not been committed so is not yet fixed.

Just stumbled on a bug, related to #12.
When content in grid is vertically aligned - single line of results is still not filled: screenshot.
Will look into it later, my content will fill up the line for sure.

P.S. And another strange behaviour when the line is almost finished, but two nodes are missing: screenshot
O O O O O O O
O O O O O

Thumbs up for #8, thanks!

StatusFileSize
new54.02 KB
new56.13 KB

I'm not sure that #8 solves the original issue reported. It does not for me, in any case.

I have a simple view that displays images (nothing else), and the grid settings are as follows:
Grouping: none
Number of columns: 4
Alignment: Horizontal
Fill up single line: checked

In Firefox, the columns are never what I specify, but simply fill up the entirety of the page width. In IE, it's even worse with the images running past my page. Images are attached!

Any other ideas (other than #8) for what may be causing this?

Having the same issue as OP and #8 patch works for me. Thanks!

#8 patch helped me too. In case it doesn't break any functionality and has no negative effects, will it be commited so one will not need to hardcode again after updating the module?

@ditcheva

Try thise one in your CSS file:

.view-galleryname td {
   width: 20%;
   padding-bottom: 2em;
}

Thanks, @Bernsch, but this does not fix my issue in IE (view still looks exactly as in my screenshot), and in Firefox, it actually stacks my tds in a single column vertically.

It seems that the patch fixes the issues for everybody else on this thread, so I may just be missing something. On the other hand, if anyone else continues to experience issues even when they apply the single line change in #8, speak up. :-)

For the moment, as a work-around, I have modified my grid views to instead use the 'unformatted list' display, because at least that does not run off the page in IE, even though you cannot specify the number of columns.

Version:7.x-3.5» 7.x-3.x-dev
Status:Needs review» Reviewed & tested by the community

The patch from #8 also fixed the issue for me.

I'm setting this issue to RTBC:

- Several people already replied it works for them.
- A similar issue (#12, #16) that was not fixed has been reported separately and will require a different fix.
- The issue from #22 is most likely a client side issue unrelated to his fix.

Patch in #8 fixes the issue for me. (Horizontal alignment)

Hi everybody!

The pach in #8 didn't fixed the issue for me. It get closer the fields each other in the columns but never fixed it totally.

I am ussing a responsive theme (I don't know if have something to do) Pixture Reloaded (adaptive theme).

Do you know something new about this issue?

Thanks!

@Rafix
Have you tried the same problem with a theme provided by drupal core? If it's working on that one, we are fine, and this is just a problem of this custom/other contrib theme. Feel free to post an issue on one of these queues.

StatusFileSize
new16.07 KB
new22.58 KB

@dawehner
Thank you for your answer. I've tried in Bartik and I think that is happening the same thing. I attach jpg with both themes in order you can see it.
Any answer will be great! Thank you again.

*I edit for further information.
In the attached jpg files I am using the patch in #8

Status:Reviewed & tested by the community» Needs work

So I guess the status can't be rtbc anymore, sorry

For me, a combination of patch in #8 and table-layout:fixed; applied to table did the trick. Thanks a ton everybody!

Status:Needs work» Reviewed & tested by the community
StatusFileSize
new36.5 KB

Issues #18 & #25 above most likely due to CSS. Please provide incorrect HTML if you believe my statement is in error.

I have tested this patch with the settings as per the attached screenshot.

Resetting this to RTBC. This needs to be committed.

It get closer the fields each other in the columns but never fixed it totally.
I've tried in Bartik and I think that is happening the same thing.
In the attached jpg files I am using the patch in #8

@Rafix: Of course, you have to apply some CSS to get it working! (screenshot 1, screenshot 2)

I forgot to mention *he said sarcastically*, that after my patch in #8 I also set the size of <td>'s with CSS.
While without #8 table cells of single line ignore the width setting and fill up the space of missing <td>'s.

Please, commit the patch already.
I have to apply this fix to my 4th project in a row.

StatusFileSize
new103.32 KB
new50.33 KB
new89.44 KB

The problem I have is the same, but only happens when less then 2 rows are used for a item.

The #8 fix doens't work for me, does anyone else know the problem?

@remixed:
Show me the HTML of your <table> and your CSS for <td> elements, not the rendered pages.

You clearly forgot to apply CSS, something like td { width: 25%; } (for fixed width table) or td { width: 250px; } (for fluid width table).
The patch does not fix CSS output for every custom theme, but it restores missing <td>s in table output of views.
It's not the fault of patch #8, but the archaic behaviour of <table>s, introduced back in 1997.
Read #32 carefully, look at screenshot 2 there.

@Ace Cooper
Thank you man. That was the problem. Now it is fixed!

Ace Cooper is correct. This patch *only* fixes the HTML output. Since it will output empty <td>s to fill the row, you must use CSS to give the <td> some width.

OK, i think we can commited to dev :-)

Status:Reviewed & tested by the community» Needs review
StatusFileSize
new875 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,658 pass(es).
[ View ]

The patch from #8 is no longer applying cleanly against 7.x-3.x-HEAD. Rerolled version attached.

#38 correctly fills up the tr with empty tds. CSS is still needed to get the desired effect.
CSS that worked for a 4 column grid

.views-view-grid.cols-4 .row-1 > td {
    width: 25%;
}

Just adjust cols-4 and the width to match your specific case. Basically cols-n needs width 1/(n).
Recommend that #38 be committed if test passes.
#38: views-fill_up_single_row-1744478-38.patch queued for re-testing.

Patch in 38 works perfectly

Thanks!

Status:Needs review» Reviewed & tested by the community

This is still RTBC.

Patch in 38 works. After patching Views generates the correct number of "TD" tags even if the number of rows is fewer than the number of columns in the grid.

The latest dev version 7.x-3.7+21-dev and the stable version 7.x-3.7 both have this problem and both are not patched. Please proceed and commit it to them!

I found that in the newly released 7.x-3.7+22-dev (Jan 11, 2014), the problem is still there. I have to patch the file as in #38 again to make the grid works normally.

Assigned:Ace Cooper» Unassigned
Priority:Normal» Major
Issue summary:View changes

Get this in already! Wake up! Yes, I could turn off notifications. No, it's not the solution. Commit this now, it's been well over a year, reviewed and circlejerked around enough. Thank you.

Priority:Major» Normal

Please do not mess with the priorities to try to promote patches. That doesn't help getting it in faster. The patch will be committed in time at the maintainers' discretion.

In the meanwhile if you are affected by this problem, you can apply the patch.

Priority:Normal» Major

I'm not promoting it by changing the priority, this is where the priority should have been all along. I've commented and patched it long ago, I'm complaining because new users still hit those problems which are major because it is so trivial to have the right number of columns on single rows.

I'm not going to comment either way about the severity of the issue but I agree with caktux. Let's get the patch at #38 rolled into Views. If there's a reason why the patch can't be applied, let's hear why. It's hard to be motivated to fix problems like this (however simple) when after we've done the work to patch and test, there's no activity.

It's true that hours of work are wasted on many Drupal modules because patches aren't committed within a reasonable time frame. This discourages people from contributing. Sometimes it is easier to get a patch committed if it is fixed in D8 first and then offered for D7. However, the grid table template will be replaced with one using divs for D8, so it is a completely different format. See [Change notice] Replace the views grid table template with one using divs

I agree this patch should be committed, but if maintainers say they do not have time, then D8 is coming soon and the problem there should be resolved.

Been working for hours in order to find out why it wasn't possible to show correct number of td's/columns when output results are less than the grid setting. Been pulling my hair out. FINALLY found this thread - so, thanks!

However: any timeline from maintainers for when the patch get's integrated in a release/dev version? ...so we don't have to do manual patching (something that I haven't done before)...

Best

Edit: don't want to sound impatient, really, but this IS truly annoying, not least considering that Views is otherwise such an amazing (!!) peace of software.

D8 is coming soon and will be resolve the issue is not a good solution...

I've been using this module (https://drupal.org/project/views_responsive_grid) and it has worked well for me. Instead of using tables, it uses divs. Hope that helps someone out.

Works well for us, too. It's a very small, logical change — would love to see this in the next release!

@ #50 - Thanks, will try this as soon as possible!

+1 please commit.

+1 please commit #38. Thanks!