Yii Framework Forum: Yii pdf [SOLVED] - Yii Framework Forum

Jump to content

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

Yii pdf [SOLVED]

#1 User is offline   erand 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 136
  • Joined: 10-December 14

Posted 07 January 2015 - 01:27 PM

I just installed pdf extension
It works fine but there is a small issue when I run it:

In admin view all records are shown (in my case 1013 records) but in the pdf only 207...

What could be the problem? I am really confused...Please help

This is the action:

	public function actionTest(){
		$model = new Teilnehmer();
		//$model->attributes = $_GET['Kunden']; /* to execute the filters (if is the case) */
		$dataProvider  = $model->search();
		
		/* if yu want to ignore the pagination and retrieve all records */
		$dataProvider->pagination = false;
		$mPDF1 = Yii::app()->ePdf->mpdf();
		$mPDF1->WriteHTML($this->renderPartial('test', array('dataProvider' => $dataProvider), true));
		$mPDF1->Output();
	}


where the view (test.php) has the same content as admin.php...

I can't figure where the problem is...
0

#2 User is offline   erand 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 136
  • Joined: 10-December 14

Posted 07 January 2015 - 04:33 PM

Working action:

public function actionTest(){
		$model = new Teilnehmer();

		$model->unsetAttributes(); <---------------------I was missing this!

		if(isset($_GET['Teilnehmer']))
			$model->attributes=$_GET['Teilnehmer'];
		
		$dataProvider  = $model->search();
		
		/* if yu want to ignore the pagination and retrieve all records */
		$dataProvider->pagination = false;
		
		$mPDF1 = Yii::app()->ePdf->mpdf();		
		$mPDF1->WriteHTML($this->renderPartial('test', array('dataProvider' => $dataProvider), true));
		$mPDF1->Output();
	}

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