CGridView save state

Hello,

(Gii CRUD)

i’m a beginer user of Yii… and i have a scenario:

User do some filters and sort to cgridview and after that user edit a record;

How user can go back to state of grid (filters, sort),but updated record, before he clicked for record details?

I’m stuk on this, can anyone please help me?

regards,

chris

Check the Yii extensions, here is one that could do for your need - http://www.yiiframework.com/extension/remember-filters-gridview

yay, thank you for quik answer, it appers it’s exactly what I need :)

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?

hi,

for keep state of page and sort : This link

As I already wrote many times, I’m friend of very simple native solutions. What do you think about this?

Save state of CGridView