i've managed to get some of the way into creating a responsive views grid layout. I'm making a view with 4 columns where the view items flow from one column to the next. If anyone wants to know the php to do this i'll share.
I do manage to get 4 columns, but all of the text in each column is sitting on top of each other. i.e. the whole view is collapsing into one line. Can anyone tell me what is wrong with the sass?
here's the html - its not all there for simplicity - the first row with class column-1 is expanded:
<div class="view view-event-list view-id-event_list view-display-id-page view-dom-id-c0443980a2da7d7e94c16f365a4df9c4">
<div class="view-content">
<div class="column-1 views-row views-row-1 views-row-odd views-row-first">
<div class="views-field views-field-title">
<span class="field-content">
<a href="/event/bangor-childrens-choir">Bangor Childrens Choir</a>
</span>
</div>
</div>
<div class="column-1 views-row views-row-2 views-row-even">
<div class="column-1 views-row views-row-3 views-row-odd">
<div class="column-2 views-row views-row-4 views-row-even">
<div class="column-2 views-row views-row-5 views-row-odd">
<div class="column-2 views-row views-row-6 views-row-even">
<div class="column-3 views-row views-row-7 views-row-odd">
<div class="column-3 views-row views-row-8 views-row-even">
<div class="column-3 views-row views-row-9 views-row-odd">
<div class="column-4 views-row views-row-10 views-row-even">
<div class="column-4 views-row views-row-11 views-row-odd">
<div class="column-4 views-row views-row-12 views-row-even views-row-last">
</div>
</div>
here's the sass:
.view-event-list .view-content{
@include zen-grid-container();
$zen-column-count: 4;
}
.view-event-list .views-row{
@include zen-grid-item-base();
}
.view-event-list .column-1 {
@include zen-grid-item(1, 1);
}
.view-event-list .column-2 {
@include zen-grid-item(1, 2);
}
.view-event-list .column-3 {
@include zen-grid-item(1, 3);
}
.view-event-list .column-4 {
@include zen-grid-item(1, 4);
}
Comments
Comment #0.0
amcc commentedcorrected error
Comment #1
Vanadu commentedI'm having the same trouble. I have a three-column grid. I want the content of each column's nodes to appear directly under the one above it. No matter what I do the View output of the second row overlaps the first row. Clearing floats and clearfixing just pushes the content of the second row below the height of the tallest column in the first row leaving a big whitespace.
I went the simple way by assigning a field value of 'column-left', column-middle' or column-right' to a field named 'grid_class' and then outputting [grid_class] using the Row Class option in the View's field settings. I get the correct class on the View's div element, but the columns always render at the top left of the grid's position, that is, if the zen-grid-item is defined at (3,1) all the view's nodes for that column will appear at the top left of that grid item and will overlap each other.
Here's the element output in Firebug. I could understand if the columns were absolutely positioned but they're not.
I can achieve the desired results without Views by creating separate divs for each node and then assigning the zen-grid-item(x,x) individually for each div. But that's a ridiculous workaround. Can someone please take a look at this and if it is by design perhaps at least explain why it is so?
Thanks...
Van
Comment #2
kristofferromIs this approach for the Responsive Views Grid module or a custom thing?
I haven't built layouts before so excuse me for my noob-question.
Comment #3
johnalbin