0

I have followed through the tutorial, http://docs.joomla.org/Adding_sortable_columns_to_a_table_in_a_component

When I have followed all instructions there, I was able sort the columns, but with only ASC direction and there is no arrow indicator.

Does anyone happen to know how to enable both ASC and DESC as well as arrow graphic indicator?

Thanks a lot.

Kelvin
  • 703
  • 1
  • 10
  • 13

1 Answers1

0

In the documentation it says something like below: ASC is right there.

public function getListQuery() {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        // ...

        $query->order($db->escape($this->getState('list.ordering', 'default_sort_column')).' '.
                $db->escape($this->getState('list.direction', 'ASC')));

        return $query;
}
Serhat Akay
  • 536
  • 3
  • 10
  • Yeah, I did append the ORDER clause to the end the query, just like how it shows in the website except I replaced 'default_sort_column' with my default sorted column. In fact, when I was messing around the code, I noticed that even though I took out the code parent::populateState('default_column_name', 'ASC'); it would still work, but again, could only sort in ASC order without arrow graphic. – Kelvin Nov 05 '13 at 17:40