I'm using Yii application. In that how to give pagination to a table contents( not using cgridview).
In view,
<table data-provides="rowlink" data-page-size="20" data-filter="#mailbox_search" class="table toggle-square default footable-loaded footable" id="mailbox_table">
<thead>
<tr>
<th></th>
<th data-hide="phone,tablet">To</th>
<th>Subject</th>
<th data-hide="phone" class="footable-last-column">Date</th>
</tr>
</thead>
<tbody>
<?php
foreach ($model as $item) {
if ($item->email_status == 1)
echo '<tr id="' . $item->emailid . '" class="unreaded rowlink" style="display: table-row;">';
else
echo '<tr id="' . $item->emailid . '" class="rowlink" style="display: table-row;">';
echo '<td class="nolink footable-first-column">';
echo '<span class="footable-toggle"></span>';
echo '</span></td>';
echo '<td>' . $item->touser->username . '</td>';
echo '<td>' . $item->email_subject . '</td>';
$originalDate = $item->time;
$newDate = date("Y-M-d H:i:s", strtotime($originalDate));
echo '<td class="footable-last-column">' . $newDate . '</td></tr>';
}
?>
</tbody>
</table>
In Controller,
public function actionOutbox()
{
$criteria = new CDbCriteria;
$criteria->order = 'time DESC';
$model = Email::model()->findAllByAttributes(array(
'from_userid' => Yii::app()->user->id
),
$criteria
);
$this->render('outbox', array(
'model' => $model,
));
}
In this code how to add pagination. I tried following different techniques but found none of them to work. Please help me.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire