How to change the order and direction of the data listed in a subpanel?

For example, in the contacts subpanel that appears in the account details view, how can I sort the data listed in the subpanel by the city field?

Thanks

1 Like

Thanks, but it doesn’t seem to be working in version 8. The file already exists. In the location public/legacy/custom/Extension/modules/module_a/Ext/Layoutdefs/module_a_module_b_module_b.php with this content

<?php
 // created: 2023-11-09 13:14:45
$layout_defs["module_a"]["subpanel_setup"]['module_b_module_a'] = array (
  'order' => 100,
  'module' => 'module_b',
  'subpanel_name' => 'default',
  'sort_order' => 'asc',
  'sort_by' => 'id',
  'title_key' => 'LBL_MODULE_A_MODULE_B_FROM_MODULE_A_TITLE',
  'get_subpanel_data' => 'module_b_module_a',
  'top_buttons' => 
  array (
    0 => 
    array (
      'widget_class' => 'SubPanelTopButtonQuickCreate',
    ),
    1 => 
    array (
      'widget_class' => 'SubPanelTopSelectButton',
      'mode' => 'MultiSelect',
      'initial_filter_fields' => ['number' => 10]
    ),
  ),
);

Trying to change the order and direction by modifying the values ​​of sort_order and sort_by and then repairing does not seem to have any effect on the list data

Sorry, should have asked which version.

Let us know if solution work for you or not.