@pcs2112 good to hear that my solution also works for others.
But i don’t understand your request because if i use the advanced search form on my site the gridview will get rendered correctly and after a successful ajax update the bbq url part is also correctly. And if i use the forward/backwards buttons of my browser the advanced search form options also get the values accordingly.
maybe some code example helps.
<?php
$basepath=Yii::app()->getBasePath();
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('#search-form-outer').toggle();
return false;
});
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('disseminations-grid', {
data: $(this).serialize()
});
return false;
});
");
?>
<div style="margin:10px">
<?php
$searchform = CHtml::link('Advanced Search','#',array('class'=>'search-button'));
$searchform.='<div id="search-form-outer" style="display:none">';
$searchform.='<div id="search-form" class="search-form">';
$searchform.=$this->renderPartial('_search',array(
'model'=>$model,
'width'=>'600px'
),true);
$searchform.='</div><!-- search-form -->';
$searchform.='</div>';
echo $searchform;
$absolute_url=Yii::app()->createAbsoluteUrl('//');
$updateSearchFormscript =<<<EOP
function updateSearchForm(id,result){
$('.search-form form').submit(function(){
$.fn.yiiGridView.update(id, {
data: $(this).serialize()
});
return false;
});
}
EOP;
Yii::app()->getClientScript()->registerScript('updateSearchForm',$updateSearchFormscript);
$export_links=CHtml::openTag('div',array('class'=>'exportbuttons'));
$export_links.=CHtml::Link(' ','',array('class'=>'excelexport tooltipleft','title'=>Yii::t('Global','Export to Excel'),'onclick'=>"location.replace($.param.querystring($.fn.yiiGridView.getUrl('disseminations-grid'),'export=1'));"));
$export_links.=CHtml::closeTag('div');
$pageSize=Yii::app()->user->getState('limit',Yii::app()->params['defaultPageSize']);
$pageSizeSelect=CHtml::openTag('div',array('class'=>'pageSizeSelect'));
$pageSizeSelect.=CHtml::Tag('span',array(),'Items per page:');
$pageSizeSelect.=CHtml::dropDownList('Disseminations[limit]',$pageSize,array(1=>1,5=>5,10=>10,20=>20,50=>50,100=>100),array(
'onchange'=>"$.fn.yiiGridView.update('disseminations-grid',{ data:{limit: $(this).val() }})",
));
$pageSizeSelect.=CHtml::closeTag('div');
$template="<div class='gridviewoptions'>{summary} $pageSizeSelect $export_links <br class=\"clearfloat\" /></div>\n{items}\n{pager}";
Yii::app()->user->setReturnUrl($this->createUrl('admin'));
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'disseminations-grid',
'dataProvider'=>$model->search(),
'ajaxUpdate'=>'disseminations-grid,search-form',
'afterAjaxUpdate'=>'updateSearchForm',
'filter'=>$model,
'cssFile'=>Yii::app()->baseUrl .'/css/grid2.css',
'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/grid2.css'),
'filter'=>$model,
'filterPosition'=>'body',
'template' => $template,
'columns'=>array(
--- columns ---
),
));
?>
</div>