Hello!
Please help me, if anyone can. How to form dataprovider so that one of the row for output to gridview has always been at the top?
I have a list of items that I want to display in the table and one of those items is the default value, that is, when user add a new item to the table, info from default item will be copied to the initial values of new item.
I would like to see this defult item displayed in the table always at top in any sorting.
To indicate the default item has a separate field in the table, named 'default_user'.
I try this code:
But when I change sorting by name to DESC - defult user go to the bottom of gridview.
What I do wrong?
Thanks for any help
Please help me, if anyone can. How to form dataprovider so that one of the row for output to gridview has always been at the top?
I have a list of items that I want to display in the table and one of those items is the default value, that is, when user add a new item to the table, info from default item will be copied to the initial values of new item.
I would like to see this defult item displayed in the table always at top in any sorting.
To indicate the default item has a separate field in the table, named 'default_user'.
I try this code:
$dataProvider = new CActiveDataProvider($this, array( 'criteria'=>$criteria, 'sort'=>array( 'multiSort'=>true, 'attributes'=>array( 'username' => array( 'asc' => 'default_user = 1, username ASC', 'desc' => 'default_user = 1, username DESC' ), 'useremail' => array( 'asc' => 'default_user = 1, useremail ASC', 'desc' => 'default_user = 1, useremail DESC' ), ), 'defaultOrder'=>array( 'username'=>CSort::SORT_ASC, 'default_user'=> 1, ), ) ));
But when I change sorting by name to DESC - defult user go to the bottom of gridview.
What I do wrong?
Thanks for any help
