3

I have a member's directory that lists the last name, first name of all the users on the site, as well as other custom field values about the members. I created a view, added contextual filter for the user's last name (Provide fixed value = "A", character limit =1), and enabled glossary mode. According to my google search results, I should automagically get an alphabetized pager. This is not happening. I made sure to save my new view. Anyone have any other ideas? What I want is an alphabetized pager that allows the user to choose the first letter of the person's last name, and display the info.

2

There are a couple of steps, each needs to be followed to get it all geared up right. The explanation at https://stackoverflow.com/questions/7354638/drupal-7-views-3-glossary-mode-where-is-it was short and sweet for this.

There are 2 view variants you need to create to make this work. First create the page variant and setup your related field as an argument (contextual filters). In the settings for the field, make sure to select the 'more' option and set the argument to behave in glossary mode. I believe you also need to set the default value to 'all' or 'a' or any other letter.

Then create the attachment variant. If you created all your fields in the page, this version should have all of them. Override the argument you selected for the page. Display this in summary mode. You will get different options depending on how you want to display your glossary. The Glossary mode should already be enabled.

The last step is to assign the attachment to the page and turn off the inheriting of contextual filters (i.e. arguments).

The best tip I received for learning how to set this up was from merlinofchaos who said to enable the Glossary view in the list of views. He said to clone it and make your changes. This gave me a thorough understanding of how it works.

  • Thanks for a solution. I found out that I got it to work by creating a clone of an existing glossary view in Views. From there, I was able to modify it to my needs, save it as a new view, and the alphabetized pagers worked. – user785179 Dec 4 '12 at 5:32
3

There is a module, Views Glossary, which provide different options to glossary views. According to the docs, it provide following features:

  1. A special kind of layout to glossary view (which is available by default with views) or any view, see in screenshot.
  2. Providing pager with selectbox and textbox.
  3. A default view is added for example.
  4. Making items per pager independent of expose form submit. (A usability improvement)
0

I struggled and struggled with creating a glossary view for members of an organic group. So when you select a group you can view the details of it. This creates a tab called Members that will show you the members of the group you are viewing. Modules used: OG, views, private message (optional), address field (optional). Just use a different 'name' field than what I have if you don't need/want address field.

Create a view: OG Members View i. Add view.... Show 'users'

ii. Create page : path= node/%/members . Menu = tab, title = Members , desc= Group Members, menu= user menu.

iii. Format = grid.

iv. Add 3 fields (or whatever you like), put in this order and remove any others.Just be consistent with whatever 'name' field you use.

a. User uid: exclude, no label. This is so can "private message" the user.

b. User profile pic: no label, thumbnail 50x50, no link.

c. User name and address full name: no label, rewrite results - output field as a link - link path= /messages/new/[uid]?destination= node/!1/members/!2. The !1 and !2 are input fields for the gid and user name field. So if you use private message and message the user, the destination parameter will then return you right back to the glossary page you were on.

v. Contextual filter OG membership: Group id. Filter not in url= display no results found, when filter value is in url - validate as group and "action to take if not validate"= show page not found.

vi. Contextual filer: user name and address full name - filter not in url = display all results. Filter is in url validate - basic validation, "action to take if filter not validate"= display no results found. Click on MORE and set glossary mode - char limit = 1, case for both is upper (uppercase is critical otherwise you'll end up having a value of both a and A for admin,Arthur!).

vii. Sort criteria= user name and address full name (asc).

ix. SAVE

Add an attachment now to this view

i. 'add' attachment. From here on want to use the "this attachment override" at top of page so hte what you change only affects the attachment on not the page you just created. If you're not careful with this you will alter your PAGE settings and have to undo them.

ii. Set "Attach to" = page, Position= before, under attachment settings. This will be the actual glossary. Turn off inherit filters. When filter is off that enables the contextual filter (which you will set a few steps down) to produce a summary.

iii. (set override) Add header, global text, and place link: show all . To use the !1 you need to turn on the 'use replacement tokens from the first row". This link provides a way 'show all' and undo the letter filter that may be in place. How? In the following link the A at the end tells the page to just show users (for that group) that start with A: http://localhost/pf/node/4/members/A . The link above has no letter at end so the display shows all. As an aside, the "pf" is just my site name, change it for what yours is... the key is to add "node/!1/members".

iv. Contextual filter: og membership group id - (set override) when filter value not available provide default value, type= raw value from url , path component is 2 ( the second one because the first one is 'node' in node/%/members. When filter value is available specify validate, og group, if "filter value not validate" then display no results found.

v. contextual filter: user name and address full name. When filter value not available check "display summary": sort asc, alpha, unformatted. Set display record count, display items inline. When filter value is available validate, basic, if "value not validate" display no results. The MORE at end should have the glossary on , char=1 etc. since it was carried forward from the page. Thus it will only summarize on first letter.

vi. SAVE

For both the attachment and the page do not, under OTHER, set use AJAX =yes. When I had it yes I received ajax log errors and it didn't work. I would click on the glossary letter and the filtering didn't occur.

Hope this helps you.

0

This new module might be helpful: https://www.drupal.org/project/alpha_pagination

It uses the glossary functionality that Patrick Kenny mentioned but it extends that in super-powerful and useful ways.

From the module page: The Alpha Pagination for Views module enables you to add an alphabetical menu in the header or footer of a views display.

Dependencies Views

Install Install the Alpha Pagination module.

Copy the alpha_pagination folder to the modules folder in your installation. Download and enable dependencies (views and views_ui). Enable the Alpha Pagination for Views module using Administer -> Modules (/admin/build/modules). Views Integration and Configuration

Build a new view of either users, content (nodes), or comments. Add whatever field you want to use as the basis for the alphabetic grouping (e.g. title, body). You can optionally exclude this field from display if you don't want it to appear in the results shown on the page for some reason. You can only choose a field that is a textfield, textarea or a textarea with a summary.

Add either a header or a footer to your view. Select the new item available in the menu of options for Global: Alpha Pagination.

Configure how you want alpha_pagination to work and specify where it should appear: set the path to the results view page.

select the field you want to use as the basis for the alphabetic grouping from the options presented in the select list (note: if the field you want to use does not appear, go back and add it to your view and then return to this configuration page to select the field).

add a context that is the same as the field you wish to use as the basis for alphabetic sorting. Be sure to enable Glossary mode and set the character limit to 1. The transform case option on the URL should be set to Upper Case.

by default the alpha pagination will apply to all displays; if you only want the alpha pagination to appear on the current display, use the drop-down menu at the top of the administrative interface to change the setting from "All displays" to "This page (override)".

An optional sample view is included and can be enabled via the alpha_pagination_example view. The sample relies on the 'article' default content type. You can create sample content using the devel module or rely on your own data.

This module exists thanks to the support of Highwire Press, Inc. and the Institute for the Arts and Humanities and UNC and was created as part of the Symposiac Conference Platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.