CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Relationship Tab 'sort by' option is running on dd/mm/yy so fails
Pages: [1]

Author Topic: Relationship Tab 'sort by' option is running on dd/mm/yy so fails  (Read 717 times)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Relationship Tab 'sort by' option is running on dd/mm/yy so fails
November 26, 2012, 01:49:23 pm
Tested on Demo - seems to be sorting by Day then Month then Year

Do we get patch-welcomed?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Relationship Tab 'sort by' option is running on dd/mm/yy so fails
November 26, 2012, 02:32:48 pm
Pete - The problem is that the jscript 'sorting widget' is sorting on the actual string values (e.g. 'September' will sort below 'November'). Not sure how to solve that??
Protect your investment in CiviCRM by  becoming a Member!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Relationship Tab 'sort by' option is running on dd/mm/yy so fails
November 27, 2012, 12:36:40 am
Hi,

Pretty sure there is an option to define the type of each column (or to add a custom sort function).

The problem is that even if you can avoid searching per string, the date format can be different (if the user changes the date format)

The usual trick is to add the date in a hidden computer readable format  (ISO 8601) and sort on that  instead of the date as displayed.

Code: [Select]
<td data-iso="2012-11-27">November 27 2012</td>

and sort on the data-iso if the type is date

rem: if you were to patch it, you can in jquery access any html5 data-xxx through $(selector).data("xxx")
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Relationship Tab 'sort by' option is running on dd/mm/yy so fails
November 28, 2012, 08:53:28 pm
so this needs to be addressed in a more global fashion i expect
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Relationship Tab 'sort by' option is running on dd/mm/yy so fails
November 28, 2012, 11:09:48 pm
Think it can be changed only at the template level I think (assuming the row data is assigned to the template and not pre-html digested  in php)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Relationship Tab 'sort by' option is running on dd/mm/yy so fails
December 06, 2012, 07:43:13 pm
I thought I had this but it slipped away on me

This looks like it should work

Index: templates/CRM/Contact/Page/View/Relationship.tpl
===================================================================
--- templates/CRM/Contact/Page/View/Relationship.tpl   (revision 44121)
+++ templates/CRM/Contact/Page/View/Relationship.tpl   (working copy)
@@ -52,12 +52,13 @@
             <th>{ts}Relationship{/ts}</th>
             <th></th>
             <th>{ts}Start{/ts}</th>
-            <th>{ts}End{/ts}</th>
+            <th id="end_date">{ts}End{/ts}</th>
             <th>{ts}City{/ts}</th>
             <th>{ts}State/Prov{/ts}</th>
             <th>{ts}Email{/ts}</th>
             <th>{ts}Phone{/ts}</th>
             <th></th>
+            <th class="hiddenElement"></th>
         </tr>
         </thead>
         {foreach from=$currentRelationships item=rel}
@@ -96,6 +97,7 @@
                 <td>{$rel.email}</td>
                 <td>{$rel.phone}</td>
                 <td class="nowrap">{$rel.action|replace:'xx':$rel.id}</td>
+                <td class="end_date hiddenElement">{$rel.end_date|crmDate}</td>
             </tr>
         {/foreach}
         </table>

(based on reading jsortable & FullText.tpl - but it's not quite there)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Relationship Tab 'sort by' option is running on dd/mm/yy so fails
December 09, 2012, 04:58:00 pm
http://issues.civicrm.org/jira/browse/CRM-11436
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Relationship Tab 'sort by' option is running on dd/mm/yy so fails

This forum was archived on 2017-11-26.