Results 1 to 6 of 6

Thread: Automatically Sort ListView by a Hidden field

  1. #1
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Automatically Sort ListView by a Hidden field

    Hi,

    I am trying to automatically sort my list views based a on value that I am not displaying the listview.

    Is it possible to do this with a custom view.list.php?

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  2. #2
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Automatically Sort ListView by a Hidden field

    Hi,

    Found this thread during a search.
    HTML Code:
    http://www.sugarcrm.com/forums/showthread.php?t=62426&highlight=order+by
    Can someone explain how this is working - it seems to be the way to do what I want.

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  3. #3
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Automatically Sort ListView by a Hidden field

    Hi,

    I've override the list view query. And in that example I've added an extra field to get sorted with the field user sorts the list view.

    Do let me know if it is clear enough.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  4. #4
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Automatically Sort ListView by a Hidden field

    Hi,

    I can following the order_by part. Its the custom controller for the action_listview I don't fully understand. How do I create the custom controller.

    I have created a file in /custom/modules/<Module_Name>/controller.php in there I have added the following

    PHP Code:
    <?php

    require_once('custom/modules/Accounts/accounts_sort.php');
    class 
    AccountsController extends SugarController{
                    function 
    action_listview(){
                     
    $this->view_object_map['bean'] = $this->bean;
                     
    $this->view 'list';
                     
    $GLOABLS['view'] = $this->view
                     $this
    ->bean = new AccountsListView();
                     }
    }
    Then in a file /custom/modules/Accounts/accounts_sort.php - is teh same as yours I've added in my field I want to sort on.


    Rgds
    Chris

    *******************************************

    UPDATE --------------- I have this resolved now. Had a typo in my accounts_sort.php

    ************************************************** **
    Last edited by chrislynch8; 2010-07-12 at 03:19 PM.
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  5. #5
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Automatically Sort ListView by a Hidden field

    Hi,

    I dont understand where are you stuck actually. Are you stuck or want to know the procedure only?
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  6. #6
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Automatically Sort ListView by a Hidden field

    Hi David,

    I've got it working. I though I was creating the above custom controller incorrectly, but it turned out t be a Typo in the accounts_sort.php file. Instead of extends Accounts I had extends Accounts.....

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sort by for listview
    By monicaDC in forum Help
    Replies: 2
    Last Post: 2010-02-04, 09:45 AM
  2. Where to put a hidden field?
    By mjp9119 in forum Developer Help
    Replies: 2
    Last Post: 2009-10-13, 05:01 AM
  3. hidden field?
    By blitz2190 in forum Help
    Replies: 0
    Last Post: 2009-09-14, 06:25 PM
  4. Hidden field
    By aswath28 in forum Developer Help
    Replies: 2
    Last Post: 2008-11-28, 10:28 AM
  5. Sort based on non-db field in Custom Module ListView
    By Tryphan in forum Developer Help
    Replies: 6
    Last Post: 2008-08-20, 12:01 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
  •