Hello,

I am creating a small block that shows the list of friends the logged in user. The fields I am using are:

- (requestee) User: Name
- User relationships: Updated date

I am trying to make a sort on the User relationships: Updated date in order to show the latest friends that where added in the relationship list.

The problem is that the User relationships: Updated date does not appear in the list of field of the sort option.

Any hint?

Thanks.

Comments

yoeld’s picture

StatusFileSize
new5.17 KB

Here is the exported view. Maybe someone wants to look inside?

alex.k’s picture

Hmm, in UR-Views it appears the field is specified as click sortable, so it should appear among sort options.

Is it sortable if you show your view as a table, and check the sort option in table display options?

yoeld’s picture

Hi Alex,

Yes, using the table layout could be a kind of workaround since it is possible to determine the sort order to the column and have it preset.

But for design purposes, I need to use the HTML list option ... . Any idea on how I could achieve this?

Thanks, Yoel

alex.k’s picture

I'm pretty sure it is an easy fix in the way the field is declared to Views. After all, it's inherently sortable, and uses the same display/filter bits as other core date elements.

alex.k’s picture

Component: Miscellaneous » Code
Assigned: Unassigned » alex.k
Category: support » feature
Status: Active » Fixed
StatusFileSize
new4.41 KB

Committed a fix for this in http://drupal.org/cvs?commit=279834. You will need to clear views cache in admin/build/views/tools. Attaching a test view that takes advantage of sorting. Please post back with results, hope it works.

yoeld’s picture

Hi Alex,

I have imported your view for testing.

In the sort section, I get an error: Error: handler for user_relationships > created_at doesn't exist!

It is logical in my case since the only available field for UR in the sort section is: User relationships: RTID

Any idea? Thanks.

alex.k’s picture

@yoeld have you upgraded to today's -dev release? You need to do that and run through update.php for this to work.

yoeld’s picture

Ooops! Sorry ... .

yoeld’s picture

StatusFileSize
new11.17 KB

Hi Alex,

I installed the latest dev version and run the update.php.

Still no change. I have added the picture of the view, just for your information.

Any suggestion? MANY thanks!

alex.k’s picture

I still cannot reproduce even after a complete uninstall and reinstall of UR. Some code must be missing in your installation. Specifically, in user_relationship_views/user_relationship_views.views.inc you should be seeing this snippet twice:

      'sort' => array(
        'handler' => 'views_handler_sort_date',
      ),

[EDIT] make sure you are running the latest Views, too.

yoeld’s picture

Hi Alex,

[EDIT] make sure you are running the latest Views, too.

That's what made the difference. It is now working perfectly.

Thanks for helping!

Status: Fixed » Closed (fixed)

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