Results 1 to 3 of 3

Thread: Sort by for listview

  1. #1
    monicaDC is offline Sugar Community Member
    Join Date
    Feb 2009
    Posts
    175

    Default Sort by for listview

    Happy New Year to all of you!
    I am running into a problem with my listview for Tasks. I want to be able to sort by the Related to (i.e. Parent) field. I added 'sortable' =>true to my custom/modules/Tasks/metadata/listviewdefs.php file, but it's not working:
    'PARENT_NAME' =>
    array (
    'width' => '20%',
    'label' => 'LBL_LIST_RELATED_TO',
    'dynamic_module' => 'PARENT_TYPE',
    'id' => 'PARENT_ID',
    'link' => true,
    'default' => true,
    'sortable' => true,
    'ACLTag' => 'PARENT',
    'related_fields' =>
    array (
    0 => 'parent_id',
    1 => 'parent_type',
    ),
    ),
    When I click on the sort by arrow, my list goes blank. Any idea on how to fix this? Thanks for the help.

  2. #2
    yannick038 is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    49

    Default Re: Sort by for listview

    I have exactly the same question. Spent 3 hours last night to make the related to field sortable.
    The problem with the blank output after having clicked is pretty simple to understand.
    If you read carrefully the Log file, you will see that the query created to display the list is ordering the results by "parent_name" field which is not present in the table (you should have parent_id but the parent_name is loaded dynamically).

    So you will get an error message in the log file like :
    MySQL error 1054: Unknown column 'parent_name' in 'order clause'

    Now i need me too to find how to change the created query to don't use the parent_name column or at least, add the related table to be able to find the values !

    Any help appreciated.


    (Sugar 5.2.0 CE)

  3. #3
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Sort by for listview

    Hi guys

    Take a look at the modules/Contacts/vardefs.php
    You need to follow the same fields definied for accounts relationship, including account_name, account_id and accounts (type = link).

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sort on Listview for dropdown lists
    By beuten in forum Help
    Replies: 4
    Last Post: 2009-11-30, 12:26 PM
  2. Column Sort Not Working: ListView
    By kurt.maderal in forum Help
    Replies: 5
    Last Post: 2009-07-15, 02:06 PM
  3. Edit Default ListView Sort Order?
    By tj@estreet.com in forum Feature Requests
    Replies: 5
    Last Post: 2009-05-27, 11:50 AM
  4. Leads - Sort name column by last name in Listview
    By Gorgar in forum General Discussion
    Replies: 5
    Last Post: 2009-02-18, 02:51 PM
  5. Default sort in listView...
    By nomar in forum Developer Help
    Replies: 18
    Last Post: 2006-07-05, 12:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •