whisere
(whisere)
November 6, 2009, 1:56am
1
I have a search function that returns a list of search results, I am using cLinkPager to control the page. But it doesn’t work as the way it should be, when I click on the second page it just return to the default control page. I konw it may need to pass the search parameters to the page link, but can’t find the method in cLinkPager to do it. Any helps would be appreciated. Thanks.
Spyros
(Spyros)
November 6, 2009, 11:22am
2
You can save the search params in globalState
Yii::app()->setGlobalState(‘searchParams’,$params)
and then use them in your controller’s search action
whisere
(whisere)
November 19, 2009, 12:45am
4
Thanks guys! These help!
But now I have another problem:
I have the following code to search across different tables:
$criteria=new CDbCriteria;
criteria->condition = $condition;
$pages=new CPagination(tbl1::model()->with(‘records’,‘records.record_name’)->together()->count($criteria));
$pages->pageSize=self::PAGE_SIZE;
$pages->applyLimit($criteria);
$models=tbl1::model()->with(‘records’,‘records.record_name’)->together()->findAll($criteria);
but then the page size is not working, pageSize=10, page1 shows 8 results, page2 shows 1.
whisere
(whisere)
January 12, 2010, 5:08am
5
The page works fine if I get rid of together() but then it can’t find column in records.record_name, saying unknown column for the query…
whisere
(whisere)
January 12, 2010, 5:10am
6
even if I use alias:
with(array(‘records’,‘records.record_name’=>array(‘alias’=>‘record_name’),))
$condition.=‘record_name.name ilike …’