How to make the $sort->link() a different css class if it is assigned as $sort->defaultOrder?
Also how to make the $sort->link() be the opposite sort order (on first page load) of the assigned $sort->defaultOrder?
How to make the $sort->link() a different css class if it is assigned as $sort->defaultOrder?
Also how to make the $sort->link() be the opposite sort order (on first page load) of the assigned $sort->defaultOrder?
Anyone able to help?
I did not tried, but I read in CSort :
for the order :
/**
* @var string the default order that should be applied to the query criteria when
* the current request does not specify any sort. For example, 'create_time DESC', or
* 'name, create_time DESC'.
*/
public $defaultOrder;
for the CSS, you could use htmlOptions
/**
* Generates a hyperlink that can be clicked to cause sorting.
* @param string the attribute name. This must be the actual attribute name, not alias.
* If it is an attribute of a related AR object, the name should be prefixed with
* the relation name (e.g. 'author.name', where 'author' is the relation name).
* @param string the link label. If null, the label will be determined according
* to the attribute (see {@link resolveLabel}).
* @param array additional HTML attributes for the hyperlink tag
* @return string the generated hyperlink
*/
public function link($attribute,$label=null,$htmlOptions=array())
Actually I want the current sort column to have a different CSS class applied to it when active.
And regarding default order, what I mean is if I specify a defaultOrder field of say "id asc", when I click the id column on first page load it does not reverse the order, it does "id asc" again.
Anyone able to help? Thanks!