If items have a different height and placed in horizontal aligned grid with different number of columns for different sizes than on smaller column count we get bad looking grid. Problem in missing responsive utilities in template for horizontal aligned variant of grid.
So I make patch with needed markup.

Comments

BondD created an issue. See original summary.

per’s picture

The patch in #1 is working properly. Thank you, we had a problem with this. The patch solved it for us.

bondd’s picture

Status: Needs review » Reviewed & tested by the community

Thank you, Per, for testing this patch.
I hope the developers will include it to the next dev release.

zenimagine’s picture

StatusFileSize
new168.71 KB

The patch does not work for me. I always have empty spaces.

zenimagine’s picture

Status: Reviewed & tested by the community » Needs work
jon pollard’s picture

Patch isn't working for me either. As a work around, if you set your grid to 4, 4, 2, 1 for the various breakpoints it works OK. It's only when you introduce a 3 column option that it stops working. Not entirely sure what it's doing, but maybe that helps diagnose the underlying problem.

jon pollard’s picture

Messing around more with the view settings, if I set this up as:

Number of columns per row - all
Number of columns (col-xs) - 1
Number of columns (col-sm) - 2
Number of columns (col-md) - 3
Number of columns (col-lg) - 4

It renders correctly across all screen sizes. I had previously had the first option set to 4. I suppose I had never really understood what this first option was for!

zenimagine’s picture

Thank you.

Can you explain what "Number of columns per row" is used for?

Have you applied the patch?

zenimagine’s picture

StatusFileSize
new317.02 KB

On my homepage, I always have a gap in my grid.
Do you have any idea of the problem ?
See screenshot.

aburrows’s picture

Link to website please

zenimagine’s picture

delete

aburrows’s picture

There are 2 clearfix divs - which is breaking the float

zenimagine’s picture

Thank you. Is this a patch problem or my css ?
How can I fix it ?

aburrows’s picture

Appears to be a problem with your code, can't replicate how you're getting the clear div

aburrows’s picture

Status: Needs work » Postponed (maintainer needs more info)
zenimagine’s picture

StatusFileSize
new370.71 KB

I remove the patch, it works but the grid is no longer lined up

aburrows’s picture

Is it using masonry?

zenimagine’s picture

StatusFileSize
new331.69 KB

If I apply the patch:
- The grids are correctly aligned.
- But it does not work on my homepage (there is an offset in the grid).

If I do not apply the patch:

- The grids are not aligned.
- But the grids of the home page are properly aligned.

How can I fix the problem ?

zenimagine’s picture

It works by adding the following code in my css :

@media screen and (max-width:480px){

.visible-xs-block {
    display: none !important;
}

Hopefully this patch will be added to the dev version

philsward’s picture

Why isn't grid for D8, taking the same input as the grid from D7? By being able to set "Number of columns per views row" to "Single Row" in D7, it wraps all of the columns in a single row.

Between this setting and "Clear columns per device size", it solved all of my problems on D7 with grids showing up funky.

These settings just need to be ported over to 8 and it "should" fix all of our issues... Couldn't believe those settings are missing from the D8 version.

damban’s picture

#7 worked for me.

And wow did it take a long tome to find this solution.

aburrows’s picture

@philsward it was an entire rewrite for 8.x but we can look into amending it. I'm using it on a few of our clients and encountering this complexity so either can explain in more detail how it works or a better approach to doing it.

aburrows’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.18 KB

So I have removed the column request at the top of the form, this appears to cause some confusion and was causing issues with the output in the twig file. Therefore it relies just off the various screen sizes to add the col sizes.

Please test this so we can get this into the latest release.

philsward’s picture

@aburrows patch makes things line up a lot better. Hope we can get some other testers to confirm.

EDIT: I say that... you have to set 'min-height' in order for it to layout properly.

The way D7 does it, hides columns based on the viewport. Might spin up a copy on D7 and take a look at the page html source code for a better idea of what the settings do.

bunthorne’s picture

My grid displayed 8 items well with 4 columns in col-lg (4-4), but 3 cols in col-lg churned out 3-1-3-1 (single columns in middle).
I applied both patches.

per’s picture

I can confirm that the patch in #23 works. But as #24 says you have to set a "min-height" in css. I don't think this is a user friendly solution for our problem. For me the first patch works better. It still needs some work to be perfect.

per’s picture

Status: Needs review » Needs work

  • aburrows committed eee11be on 8.x-3.x
    Issue #2873555 by aburrows, BondD, zenimagine: Missing responsive...
aburrows’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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

Christopher Riley’s picture

This issue should not be marked fixed as options are not being set correctly as I have discovered per https://www.drupal.org/project/views_bootstrap/issues/3018627