Sorting fields in Subpanels within Accounts Module

Hi,


 

I have  been searching for ages for this and tried everything I could fine online but  nothing seems to work.

   

I have  custom modules setup as subpanels within Accounts. So under Accounts I can see  the subpanels. All I want to do is for each subpanel I have listed is to set a  default sort option by a specific field. I have tried the below code:

   

"\custom\modules\Accounts\metadata\subpaneldefs.php"

   

$layout_defs['Accounts']['subpanel_setup']['accounts_sits_technical_passwords_1']['sort_order']  = 'ASC';
  $layout_defs['Accounts']['subpanel_setup']['accounts_sits_technical_passwords_1']['sort_by']  = 'purpose_c';

   

I have tried  putting this in various places including extensions but nothing seems to work.  It seems to keep the last desired search option the user has selected.

   

Anyone  please help it is driving me mad. :)

PS: I am running CE 6.5.20

   

Thanks All 

Parents
  • I can help you again.

    for example, you need to sort records by field "my_custom_field_c" in Module Contacts.
    So you need to edit "/custom/modules/Contacts/views/view.list.php"
    edit function:
     function listViewPrepare() {
                $_REQUEST['orderBy'] = strtoupper('my_custom_field_c'); //set the field to order by NOTE: MUST BE ALL CAPS!
                $_REQUEST['sortOrder'] = 'DESC'; //set the order, ascending or descending
     
           parent::listViewPrepare(); //continue running the extended function's code
      }


    P.S. if my replies help you, you can at least hit "like" )))

Reply
  • I can help you again.

    for example, you need to sort records by field "my_custom_field_c" in Module Contacts.
    So you need to edit "/custom/modules/Contacts/views/view.list.php"
    edit function:
     function listViewPrepare() {
                $_REQUEST['orderBy'] = strtoupper('my_custom_field_c'); //set the field to order by NOTE: MUST BE ALL CAPS!
                $_REQUEST['sortOrder'] = 'DESC'; //set the order, ascending or descending
     
           parent::listViewPrepare(); //continue running the extended function's code
      }


    P.S. if my replies help you, you can at least hit "like" )))

Children
No Data