Results 1 to 6 of 6

Thread: Sort List Layout by Custom Field

  1. #1
    colinake is offline Member
    Join Date
    Jun 2008
    Posts
    5

    Question Sort List Layout by Custom Field

    I've added a custom field in several places and in some cases added them to the list layout in their particular module. However, I can't sort the results by this field. Is there something I'm overlooking in studio that would allow me to do this? I can't find anything elsewhere on the forums or the wiki about this issue.

    Let me know if I'm straight up missing something or if it takes wearing a special hat and holding your tongue a certain way.

    Thanks

  2. #2
    colinake is offline Member
    Join Date
    Jun 2008
    Posts
    5

    Default Re: Sort List Layout by Custom Field

    Does anyone have any insight into this? I've dug around a bit more but still can't find anything that would make these custom fields sortable.

    Is the only way to do this messing with the PHP? And if we do that, wouldn't it be lost in the case of an upgrade?

    Thanks in advance

  3. #3
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: Sort List Layout by Custom Field

    It's a thing you can do via php.
    If you created a module via module builder, open <sugar-root>/custom/modules/<your_module>/metadata/listviewdefs.php
    you'll see the list of all fields, locate yours and add the line 'sortable' => true, (comma included) as in the following example:
    PHP Code:
    'MY_FIELD_NAME' => 
        array (
          
    'width' => '10',
          
    'label' => 'LBL_MY_FIELD',
          
    'sortable' => true
          
    'default' => true,
        ), 
    Since it's inside <sugar-root>/custom/modules/<your_module>/metadata/ you will not loose this mod when you update or change things via studio (unless you remove this field of course...)
    What do you think the cookie monster eats ?

  4. #4
    colinake is offline Member
    Join Date
    Jun 2008
    Posts
    5

    Default Re: Sort List Layout by Custom Field

    Thanks, DragonFlyMaster. I really appreciate it. If I make this change inside a standard module (like Opportunities, in this case), I'm assuming it won't be in the custom folder and the changes will be lost when an upgrade is made?

    Thanks once again

  5. #5
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: Sort List Layout by Custom Field

    Quote Originally Posted by colinake
    Thanks, DragonFlyMaster. I really appreciate it. If I make this change inside a standard module (like Opportunities, in this case), I'm assuming it won't be in the custom folder and the changes will be lost when an upgrade is made?

    Thanks once again
    If you modify a standard module via Studio, you'll get a <module_name> folder in custom/modules/ containing the proper files for your customizations.
    In your case, go to admin->studio->opportunities->layouts->listview and make some changes, then save and deploy. This will create the file <sugar-root>/custom/modules/Opportunities/metadata/listviewdefs.php. Open it, locate your custom field and add that line
    PHP Code:
    'sortable' => true
    What do you think the cookie monster eats ?

  6. #6
    colinake is offline Member
    Join Date
    Jun 2008
    Posts
    5

    Default Re: Sort List Layout by Custom Field

    Quote Originally Posted by DragonflyMaster
    If you modify a standard module via Studio, you'll get a <module_name> folder in custom/modules/ containing the proper files for your customizations.
    In your case, go to admin->studio->opportunities->layouts->listview and make some changes, then save and deploy. This will create the file <sugar-root>/custom/modules/Opportunities/metadata/listviewdefs.php. Open it, locate your custom field and add that line
    PHP Code:
    'sortable' => true
    This will do the trick. Thanks so much - I appreciate the help!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 2010-07-29, 06:33 AM
  2. Replies: 0
    Last Post: 2008-04-16, 06:27 AM
  3. Replies: 0
    Last Post: 2006-12-20, 11:39 PM
  4. Replies: 0
    Last Post: 2006-11-09, 03:04 PM
  5. Replies: 0
    Last Post: 2005-08-17, 07:06 AM

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
  •