Hi,
Is there a way to specify the default sort field and order for list views. I’m looking for a definition that can be placed in custom vardef, listviewdefs or searchdefs files. Whilst the order is (mostly) remembered, if the ‘Clear Search’ button is clicked prior to a new search it always returns to the system default: date_entered rather than my chosen default.
There seems to be the ability to specify the sort_by and sort_order for subpanels, but nothing for listview, so it seems strange that there isn’t something similar in list view. Following much googling I’ve also tried changing the $_REQUEST using a custom view.list.php file, but this doesn’t work either.
I have tried this Advanced Filter in my Support Tickets, with Ascending, by Created Date, and I get the ones at the top that were created a month ago, not the ones created today.
public function preDisplay()
{
$userPreferenceOrder = $GLOBALS['current_user']->getPreference('listviewOrder', 'AOK_KnowledgeBase2_AOK_KNOWLEDGEBASE'); // you can get required category name from "user_preferences" table.
if(empty($userPreferenceOrder['orderBy']))
{
$_REQUEST['orderBy'] = 'field_name';
$_REQUEST['sortOrder'] = 'DESC';
}
parent::preDisplay();
}