Yii Framework Forum: Bagaimana menggunakan CPagination - Yii Framework Forum

Jump to content

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

Bagaimana menggunakan CPagination Semua tentang Teknik Paging (Pagination) Rate Topic: -----

#1 User is offline   nasrul 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 14-April 09
  • Location:Sorowako - Indonesia

  Posted 29 December 2009 - 09:05 AM

mohon pencerahan:
Saya buat 2 buah datagrid dalam view show. ingin melengkapinya dengan pagination.
saya coba implementasikan prosedur seperti dalam action list atau admin ke dalam action show namun tidak bekerja.

potongan scriptnya:
controller
...
	public function actionShow()
	{
		$sjurusan=$this->loadSpesialisasiJurusan();
		
		$criteria=new CDbCriteria;
		$pages=new CPagination(SpesialisasiJurusan::model()->with('kurikulums')->count());
		$pages->pageSize=self::PAGE_SIZE;
		$pages->applyLimit($criteria);
		
		$kurikulum=$this->newKurikulum($sjurusan);
		$this->render('show',array(
			'sJur'=>$sjurusan,
			'kurikulums'=>$sjurusan->kurikulums,
			'kurPages'=>$pages,
			'newKurikulum'=>$kurikulum,
		));
	}
...


views/show
...
	<?php if(!empty($kurikulums)) : ?>
<table class="dataGrid">
	<?php foreach($kurikulums as $n=>$kurikulumItem): ?>
	<tr valign="top" class="<?php echo $n%2?'even':'odd';?>">
		<th width="20" align="right">
			<?php echo $n+1; ?>
		</th><td width="300" style="margin-left:50;">
			<?php echo CHtml::encode($kurikulumItem->mk->id." - ".$kurikulumItem->mk->nama); ?>
		</td><td width="200" align="center">
			<?php echo CHtml::encode($kurikulumItem->mkg->Nama." (".$kurikulumItem->mkg->ket.")"); ?>
		</td><td width="100" align="center">
			<?php echo CHtml::encode($kurikulumItem->sks); ?>
		</td>
		<td>[Kontrak Mahasiswa]</td>
	</tr>
	<?php endforeach; ?>
</table>
<div class="actionBar">
<hr/>
Halaman: <?php $this->widget('CLinkPager',array('pages'=>$kurPages)); ?>
</div>
<?php endif; ?>
...

atas setiap respon dan masukan saya ucapkan terima kasih banyak
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