I've created various extra fields in Accounts, but there doesn't seem to be a sensible way of changing the sort for every user in the system.
One of our fields is a number field called ACCNO so I want to sort all of the Accounts via ACCNO as a decreasing number so the highest account number at the top going down.
I know per user you can go in advanced view and set this but as soon as they click CLEAR, this disappears, so I need to edit the system to ensure it's always defaulting to this.
I guess I need to go into Custom / modules / Accounts / views and create a file called ListViewData.php but not really sure what code i Need :) Anyone done similar and can give me a starting point to work from. I'd really appreciate it.
1) Create a file at location: custom/modules/Accounts/views/view.list.php.
2) Add the following code, to default sort the Accounts list view:
require_once('include/MVC/View/views/view.list.php');
class AccountsViewList extends ViewList
{
public function listViewPrepare()
{
if (empty($_REQUEST['orderBy'])) {
$_REQUEST['orderBy'] = 'ACCNO';
$_REQUEST['sortOrder'] = 'desc';
}
parent::listViewPrepare();
}
}