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.
Page 1 of 1
cLinkPager for search results
#2
Posted 06 November 2009 - 06:22 AM
You can save the search params in globalState
Yii::app()->setGlobalState('searchParams',$params)
and then use them in your controller's search action
Yii::app()->setGlobalState('searchParams',$params)
and then use them in your controller's search action
#4
Posted 18 November 2009 - 07:45 PM
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.
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.
#5
Posted 12 January 2010 - 12:08 AM
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...
#6
Posted 12 January 2010 - 12:10 AM
even if I use alias:
with(array('records','records.record_name'=>array('alias'=>'record_name'),))
$condition.='record_name.name ilike ...'
with(array('records','records.record_name'=>array('alias'=>'record_name'),))
$condition.='record_name.name ilike ...'
Share this topic:
Page 1 of 1