I use the first/last grouping options and needed to wrap those groups in a div to clear floated elements in the preceding rows. The patch lets you choose to add a wrapper by stating a class for that wrapper. If you enter no class (empty by default) it won't create a wrapper.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

can you give me a link or attach some HTML that shows this in action? (you can DM on twitter if you want to share privately.)

tim.plunkett’s picture

Status: Active » Needs review
FileSize
5.18 KB

Nitpicked some minor coding standards/whitespace discrepancies.
Variables don't need to be explicitly set to NULL.

Looks good at first glance.

mason@thecodingdesigner.com’s picture

FileSize
6.91 KB

Site is in dev and not online yet. I'm uploading an extract that shows the view I've applied this to. Look for: <section class="view view-releases ">

I've got views results grouped in threes, with each grouping surrounded by <div class="wrapper"></div> tags.

Anonymous’s picture

Mason:

Why doesn't CSS clear work for this situation?

section.view-releases .first {
clear: left;
}

Why do you specify div? Couldn't there be some other container for all your rows? (tr for example)

mason@thecodingdesigner.com’s picture

I had items of uneven height, and clear: left wasn't making a consistant grid. This also allows for styling on the grouping of items. I made it a div in an effort to keep it simple. Despite this coming dangerously close to recreating tables, I wanted an element that didn't go *that* far.

mansspams’s picture

you can use ctools/panels to get panel display style and wrap different field sets in custom templates. no need for patch here unless it will be somehow easier.

tim.plunkett’s picture

This is in no way related to Panels/Ctools.

timd.mackey’s picture

@tim.plunkett, your patch revision seems to have broke something, at least for me. Instead of getting one grouping div after another, I'm getting several nested groups in a row, followed by individual rows wrapped in a grouping div each.

@canaryMason, your patch appears to me to be working correctly. Thanks, I really needed this.

drupal a11y’s picture

Is this also possible for D7?

WillowDigit’s picture

Thanks a lot

Applied the patch to semantic views 7.x-1.x-dev and it worked like a charm! I only had to test whether a few variables were set in order to get rid of a few undefined indexes in the event that I applied no class to the containing wrapper.

hanoii’s picture

Title: patch: option to allow div wrappers on groups of rows » More wrappers options and UI improvements
Version: 6.x-1.1 » 7.x-1.x-dev
Issue summary: View changes
FileSize
15.37 KB

I was going to submit a new issue but I think this one is completely covered by it so contributing here. Being 6.x such an old version I would just submit the patch to 7.x.

This patch introduces several improvements to the current module:

  1. Replaces the list wrapper for a general row wrapper for rows, so you can use any block element here, not just ul, li, dl, etc. This uses the same config name so previous configurations will still work.
  2. Conditionally show grouping element when group is available and selected and added a group wrapper to the configuration options. When you are grouping fields, the row wrapper wraps each group of rows, with the group wrapper you have yet one more wrapper to configure around both the group title and group rows.
  3. Added a rows wrapper using a similar technique like the original patch but reworked it. Now you can have a top level wrapper outside of all groups. This will only work if no/one grouping is selected. The way nested grouping is rendered by views, this setting won't have the exact same behavior. It is explained on the patch
hanoii’s picture

FileSize
15.38 KB

Small fix on the patch