Yii Framework Forum: CActiveDataProvider pagination and force set itemcount - Yii Framework Forum

Jump to content

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

CActiveDataProvider pagination and force set itemcount Rate Topic: -----

#1 User is offline   Zdunek 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 10-July 17

Posted 16 November 2017 - 02:12 PM

Hi,

I have some specific problem. My criteria are very heavy and i need only search some records without count all items. I have item count in cache(I use xcache).

for tests I trying this:
   $criteria->limit = 20;
        $CActiveDataProvider = new CActiveDataProvider($this, array(
            'criteria' => $criteria,
			
            'pagination' => array(
            'pageSize' => isset($_GET['pageSize']) ? (int) $_GET['pageSize'] : 20,
            'ItemCount' => 6,
            ),
			//*/
			//'pagination' => false,
            'sort' => $sort,
            'totalItemCount' => $this->countCandidate()
        ));
        return $CActiveDataProvider;


Is there a way to bypass the counting of records and set them manually in pagination?
0

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,500
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 16 November 2017 - 02:33 PM

I am afraid you might not able to achieve that with ActiveDataProvider I could be wrong it has been a while since I have touched yii 1. but I know you can use SqlDataProvider if you want control over the count query and items query.

here this might help you

http://www.yiiframew...qlDataProvider/
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