Yii Framework Forum: Cgridview - Yii Framework Forum

Jump to content

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

Cgridview How prevent auto fill grid view on page load??? Rate Topic: -----

#1 User is offline   mahdi1986 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 14-February 13

Posted 16 June 2013 - 08:43 AM

Hi dear,
I have a Table with 20 million record,
How can I prevent fill grid-view on page load??????
I googled, but I can not find any solution :(
please help me
thanks
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,598
  • Joined: 04-March 10
  • Location:UK

Posted 16 June 2013 - 09:17 AM

There's a discussion here that might be of help.
0

#3 User is offline   mahdi1986 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 14-February 13

Posted 16 June 2013 - 11:26 PM

No, I can't find solution :(
0

#4 User is offline   Alexander Ast 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 08-June 13

Posted 17 June 2013 - 03:20 AM

Did you try using pagination on dataprovider, that is taking to CGridView widget?
0

#5 User is offline   mahdi1986 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 14-February 13

Posted 17 June 2013 - 03:30 AM

View PostAlexander Ast, on 17 June 2013 - 03:20 AM, said:

Did you try using pagination on dataprovider, that is taking to CGridView widget?


Yea,I use pagination, but I dont like fill grid view every page load, because my database have a heavy data
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,353
  • Joined: 12-October 09
  • Location:Croatia

Posted 17 June 2013 - 03:56 AM

For this you need to create a dataprovider that returns an empty data set check this thread for an idea - http://www.yiiframew...vedataprovider/
Find more about me.... btw. Do you know your WAN IP?
1

#7 User is offline   mahdi1986 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 14-February 13

Posted 17 June 2013 - 06:15 AM

View PostMaurizio Domba, on 17 June 2013 - 03:56 AM, said:

For this you need to create a dataprovider that returns an empty data set check this thread for an idea - http://www.yiiframew...vedataprovider/


thanks for replay, I use this hint to my model, it is correct?
public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;
		$criteria->compare('dir',$this->dir,false);
        $criteria->mergeWith($this->dateRangeSearchCriteria('creation_time', $this->creation_time));
		$criteria->compare('request_agent_type',$this->request_agent_type,true);
		$criteria->compare('request_status',$this->request_status,true);
		$criteria->compare('tracking_no',$this->tracking_no,true);
		$criteria->compare('cif',$this->cif,true);
		$criteria->compare('account_number',$this->account_number,true);
		$criteria->compare('card_number',$this->card_number,true);
		$criteria->compare('national_code',$this->national_code,true);
		$criteria->compare('bank_code',$this->bank_code,true);
        $criteria->order="id desc";

        if(Yii::app()->request->isAjaxRequest)
        {
            return new CActiveDataProvider($this, array(
                'criteria'=>$criteria,
                'pagination' => array(  'pageSize'=>Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']),
                )
            ));
        }
        else
        {
                 return new CActiveDataProvider('RequestSms',array('data'=>array()));
        }


	}

And I like don show gridview in init form, Is it way to hidden gridview in init view?
thanks for attension
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