Yii Framework Forum: cLinkPager for search results - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

cLinkPager for search results Rate Topic: -----

#1 User is offline   whisere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 05-November 09

Posted 05 November 2009 - 08:56 PM

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.
0

#2 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

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
0

#3 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 18 November 2009 - 02:37 PM

see this
maybe help you

http://www.yiiframew...search-results/
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

#4 User is offline   whisere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 05-November 09

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.
0

#5 User is offline   whisere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 05-November 09

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...
0

#6 User is offline   whisere 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 05-November 09

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 ...'
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users