Yii Framework Forum: Pagination - Yii Framework Forum

Jump to content

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

Pagination

#1 User is offline   Lalu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 24-January 13

Posted 14 March 2013 - 11:54 PM

hello everyone
my problem related to pagination yii
like when i click on the 2nd of the pagination it is append entire cgirdview on the cuurent page cgridview instead of display 2nd page of the pagination
my code like

//list_all.php
$this->widget('zii.widgets.grid.CGridView', array(
'htmlOptions' => array('class' => ''),
'itemsCssClass' => 'tables',
'pagerCssClass' => 'dtPagination',
'template' => '{items}{pager}',
'id' => 'friend-transaction',
'dataProvider' => $data_provider,
'pager' => array(
'header' => '',
'firstPageLabel' => '<<',
'prevPageLabel' => '<',
'nextPageLabel' => '>',
'lastPageLabel' => '>>',
),
'columns' => array(
array(
'name' => 'created',
'value' => 'date("d/m/Y",strtotime($data->sattlement_date))',
'type' => 'raw',
'htmlOptions' => array('width' => '10%')
),
array(
'name' => 'New Debt & Record Payment Details',
'value' => '
CHtml::link(
(($data->bill_id)? $data->bill->title:$data->debit_user->first_name . CHtml::image(Yii::app()->request->baseUrl . "/images/paid_1.png"). $data->credit_user->first_name),
Yii::app()->createUrl("transaction/view",array("id"=>$data->primaryKey)),
array("title" => "View transaction")).
"<br />Make by <b>::</b> ".Yii::app()->user->name',


'type' => 'raw',

),
array(
'name' => 'Amount',
'value' => '"<div class=\"simple_buttons\"><div class=\"".(($data->debit_user_id == Yii::app()->user->id) ? "debit_amount" : "credit_amount")."\">". $data->amount."</div></div>"',
'type' => 'raw',
'htmlOptions' => array('align' => 'right', 'width' => '20%')
),
),
));
?>




<div class="widget_contents noPadding" >
<?php
// List all transaction between friends.
$this->widget('zii.widgets.grid.CGridView', array(
'htmlOptions' => array('class' => ''),
'itemsCssClass' => 'tables',
'pagerCssClass' => 'dtPagination',
'template' => '{items}{pager}',
'id' => 'friend-transaction',
'dataProvider' => $group_provider,

'pager' => array(
'header' => '',
'firstPageLabel' => '&lt;&lt;',
'prevPageLabel' => '&lt;',
'nextPageLabel' => '&gt;',
'lastPageLabel' => '&gt;&gt;',
),
'columns' => array(
array(
'name' => 'created',
'value' => 'date("d/m/Y",strtotime($data->created_date))',
'type' => 'raw',
'htmlOptions' => array('width' => '1%')
),
array(
'name' => 'Group Details',
'value' => '
CHtml::link(
(($data->bill_id)? $data->name:$data->name),
Yii::app()->createUrl("transaction/grouppayment",array("id"=>$data->id)),
array("title" => "View transaction")).
"<br />Make by <b>::</b> ".Yii::app()->user->name',


'type' => 'raw',
'htmlOptions'=>array('width'=>'70%')

),

array(
'name' => 'Amount',
'value' => '$data->amount',
'type' => 'raw',
'htmlOptions' => array('align' => 'center', 'width' => '20%')
),
),
));
?>

transactionContoller.php

public function actionListAll()
{
// Get Bill Settlement model
$model = new BillSettlementDtl();

// Data provider for settlement detail table for grid view
$dataProvider = new CActiveDataProvider('BillSettlementDtl', array(
'criteria' => array(
'condition' => '
(
debit_user_id = "' . Yii::app()->user->id . '" OR
credit_user_id = "' . Yii::app()->user->id . '"

)
'
),
'pagination'=>array(
'pageSize'=>5,
'pageVar'=>'page',
)
));


$groupProvider = new CActiveDataProvider('BillItemDtl', array(
'criteria' => array(
'condition' => '
(
user_id = "' . Yii::app()->user->id . '"


)
'

),
'pagination'=>array(
'pageSize'=>5,
'pageVar'=>'page',

)
));






// Render output
$this->render('list_all', array('model' => $model,'data_provider' => $dataProvider,'group_provider'=>$groupProvider));
}


SO PLESE HELP ME
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 16 March 2013 - 09:58 AM

/* Please don't duplicate the post. Other 2 threads are removed. */
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