Cgridview

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

There’s a discussion here that might be of help.

No, I can’t find solution :(

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

For this you need to create a dataprovider that returns an empty data set check this thread for an idea - http://www.yiiframework.com/forum/index.php/topic/31418-new-and-empty-cactivedataprovider/

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