Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Sorting by Columns does not work

  1. #1
    urs.pamp@gmail.com Guest

    Default Sorting by Columns does not work

    Hi there!

    We're having problems sorting by columns in list view with all modules.
    We did manage to sort the list view of the used modules by default by their names by editing include/ListView/ListViewData.php.
    But we are not able to manually sort the list view by other column headers like status, team or start date (see the screenshot below). We're able to click the headers, but the records won't be sorted.

    We tried editing custom/modules/<Modulename>/metadata/listviewdefs.php and making the headers sortable by adding "'sortable' => true,". The problem still remains unresolved.

    How do you make ALL headers sortable (besides name)?

    Thank you!
    Screenshot:
    Name:  2013-02-11 10.22.03 am.png
Views: 275
Size:  48.5 KB

  2. #2
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,638

    Default Re: Sorting by Columns does not work

    Are you getting javascript errors when you try and sort?
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk

    SugarCRM Enterprise 6.5.12

  3. #3
    urs.pamp@gmail.com Guest

    Default Re: Sorting by Columns does not work

    Do you mean in Firebug?
    I have no errors under console/errors.
    The browser itself does not throw any errors.
    I'd be happy to give you further information from Firebug.

  4. #4
    urs.pamp@gmail.com Guest

    Default Re: Sorting by Columns does not work

    No one having the same problems?

  5. #5
    davidboris's Avatar
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,525

    Default Re: Sorting by Columns does not work

    Hello,

    Which field type are you trying to sort?
    If you have done customizations in include/ListView/ListViewData.php, it is first of all unupgrade safe and it affects all module's query.
    Echo out the query when you do sorting > Urdhva Tech: Where are the queries? and check if the query is good or not.
    Web : http://www.urdhva-tech.com
    Twitter : @urdhvatech
    Email : contact@urdhva-tech.com
    Blog : Urdhva-Tech
    Skype : urdhvatech

    Our Premium Projects for SugarCRM:
    Premium theme for SugarCRM CE (Community Edition 6.5+ with 4 combinations, Black + Orange/Red/Green/Blue, bootstrap3 based)
    Duplicate detector to avoid duplicate data entry.
    Customer Self Service Portal for All Flavours.
    tagMe A complete tag management for SugarCRM.
    Meeting Map Reminder Meeting reminder with Gmap in Email

  6. #6
    urs.pamp@gmail.com Guest

    Default Re: Sorting by Columns does not work

    I'd like to sort different types: xxx
    We did customize include/ListView/ListViewData.php, but just:
    Code:
    if ($GLOBALS['module'] == 'Opportunities')
    {
        $orderBy = 'opportunities.name ASC';
    }
    
    if ($GLOBALS['module'] == 'Contacts')
    {
        $orderBy = 'contacts.last_name ASC';
    }
    
    if ($GLOBALS['module'] == 'Accounts')
    {
        $orderBy = 'accounts.name ASC';
    }
    ... in order to sort the modules by names by default. Do you know how to do this in an upgrade safe way?

    How do i print out the query?

  7. #7
    davidboris's Avatar
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,525

    Default Re: Sorting by Columns does not work

    Hello,

    Extend list view query > Urdhva Tech: Extending List View query
    Print query > Urdhva Tech: Where are the queries?
    Web : http://www.urdhva-tech.com
    Twitter : @urdhvatech
    Email : contact@urdhva-tech.com
    Blog : Urdhva-Tech
    Skype : urdhvatech

    Our Premium Projects for SugarCRM:
    Premium theme for SugarCRM CE (Community Edition 6.5+ with 4 combinations, Black + Orange/Red/Green/Blue, bootstrap3 based)
    Duplicate detector to avoid duplicate data entry.
    Customer Self Service Portal for All Flavours.
    tagMe A complete tag management for SugarCRM.
    Meeting Map Reminder Meeting reminder with Gmap in Email

  8. #8
    urs.pamp@gmail.com Guest

    Default Re: Sorting by Columns does not work

    Thanks for the links. I'm sorry, but I can't figure out what to do with these links.
    I reckon to edit include/ListView/ListViewData.php below the line
    Code:
    $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from']
    Now, what exactly do i write there?

    The whole function?
    Code:
    function listViewProcess() {
            global $current_user;
            $this->processSearchForm();
            if(!$current_user->is_admin) // remove this condition if you dont want admin user to view the "Closed Lost" Opportunities.
                $this->params['custom_where'] = ' AND opportunities.sales_stage <> "Closed Lost" ';
           
            if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
                $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
                $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
                echo $this->lv->display();
            }
        }

  9. #9
    davidboris's Avatar
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,525

    Default Re: Sorting by Columns does not work

    Hello,

    Quote Originally Posted by urs.pamp@gmail.com View Post
    ... in order to sort the modules by names by default. Do you know how to do this in an upgrade safe way?

    How do i print out the query?
    Those links are the answers to your questions.

    To extend the list view query you follow the steps mentioned in Urdhva Tech: Extending List View query

    And to display your query on list view, you write print $main_query; right after the line $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from']
    Web : http://www.urdhva-tech.com
    Twitter : @urdhvatech
    Email : contact@urdhva-tech.com
    Blog : Urdhva-Tech
    Skype : urdhvatech

    Our Premium Projects for SugarCRM:
    Premium theme for SugarCRM CE (Community Edition 6.5+ with 4 combinations, Black + Orange/Red/Green/Blue, bootstrap3 based)
    Duplicate detector to avoid duplicate data entry.
    Customer Self Service Portal for All Flavours.
    tagMe A complete tag management for SugarCRM.
    Meeting Map Reminder Meeting reminder with Gmap in Email

  10. #10
    urs.pamp@gmail.com Guest

    Default Re: Sorting by Columns does not work

    Thank you very much, davidboris! I didn't thought I had to really do the exact same thing. Sorry for that!

    Now, i got the queries. The query I get when accessing the module Opportunities (which by default is sorted by "name") is identical to the query I get when i click the header "Jira-Link" (a URL-field).
    So the query seems to be the problem, because it's the same.

    What would you recommend now?

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. More Screen Columns
    By citapinc in forum Help
    Replies: 4
    Last Post: 2011-11-02, 06:46 PM
  2. Is this possible (three columns in a module)
    By chrislynch8 in forum General Discussion
    Replies: 3
    Last Post: 2009-07-23, 08:29 AM
  3. Replies: 2
    Last Post: 2009-07-09, 04:22 PM
  4. Saved search & Layout: Columns sorter not working [Display Columns]
    By kurt.maderal in forum General Discussion
    Replies: 0
    Last Post: 2009-07-08, 02:12 PM
  5. Error sorting listview columns
    By stewart05 in forum Help
    Replies: 2
    Last Post: 2009-03-18, 11:03 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
  •