Filters are saved, it;s ok, but i tried to add paging/sort functionality as described;
I thing i do somethig wrong at this stage:
"This should be placed into Model::search() function, whereas Model has two additional filter variables "sort" and "page"."
class BPersonList extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @return BPersonList the static model class
*/
[b] public $sort;
public $page;[/b]
public static function model($className=__CLASS__)
{
return parent::model($className);
}....
Adding support to remeber sorting and active pager page
Hi, I think you can pretty easily add support for remebering sorting order and active page in pager like so:
// store also sorting order
$key = get_class($this).’_sort’; // e.g. Model_sort
if(!empty($_GET[$key])){
$this->sort = $_GET[$key]; // update sorting key
}elseif(!empty($this->sort)){
$_GET[$key] = $this->sort; // set latest sorting key
}
// store active page in page
$key = get_class($this).’_page’; // e.g. Model_page
if(!empty($_GET[$key])){
$this->page = $_GET[$key]; // update current active page
}elseif(!empty($this->page)){
$_GET[$key] = $this->page; // set latest active page
}
This should be placed into Model::search() function, whereas Model has two additional filter variables "sort" and "page".
I did something wrong?